I recall how scared so many of us were in October of 1962 when President Kennedy confronted Soviet First Secretary Nikita Khrushchev's attempted deployment of nuclear missiles in Cuba. Kennedy let the Soviets know with a naval "quarantine" against Cuba that under no circumstances would he allow the USSR to deploy nuclear warheads that close to Washington, D.C. Had Khrushchev not backed down, it would have meant war, likely nuclear war.
Today, President Putin saw the specter of likely soon-to-be NATO Ukraine harboring NATO forces, including nuclear and anti-nuclear missiles on their border with Russia, deployed way too close to Moscow. He warned Ukraine, but Ukrainian President Zelenskyy continued stating publicly that he wanted Ukraine to join NATO, which most of the country supported. President Putin was not going to wait for Ukraine to be part of NATO when any action he took against Ukraine to prevent missile deployment so visibly close to Moscow would require NATO nations to join in defense of Ukraine, in what would likely become an all-out nuclear war. So he took the only non-nuclear option he believed could deter NATO from accepting Ukraine: neutralize Ukraine's military so that NATO would not want to deploy missiles there, as without a Ukrainian military presence, there would be no security for the NATO missiles. Tragically, the ground war Putin was resigned to employ is destroying Ukraine, because unlike Khrushchev, Zelenskyy did not back down.