SEVASTOPOL, Crimea — Surrendering to Russia’s inexorable seizure of Crimea, Ukraine announced plans Wednesday for mass troop withdrawals from the strategic peninsula as Moscow-loyal forces seized control of Kiev’s naval headquarters here and detained its commander.
Attempting to face down the unblinking incursion, Ukraine said it would hold joint military exercises with the United States and Britain.
Hours after masked Russian-speaking troops forced their way onto Ukraine’s main naval base here, forlorn Ukrainian soldiers streamed out carrying clothing and other belongings in bags. A group of local militia and Cossacks, later joined by officers from Russia’s Black Sea Fleet, looked on.
Just how many retreating troops Ukraine will have to absorb was unclear as many servicemen in Crimea have already switched sides to Russia, but authorities say it was prepared to relocate up to 25,000 soldiers and their families.
Humbled but defiant, Ukraine lashed out symbolically at Russia by declaring its intent to leave the Moscow-dominated Commonwealth of Independent States, a loose alliance of 11 former Soviet nations. The last nation to leave the group was Georgia, which lost a brief war with neighboring Russia in 2008 and ended up losing two separatist territories.
Vice President Joe Biden, in Lithuania trying to reassure nations bordering Russia alarmed by the sight of an expansion-minded neighbor, said the United States would stand by them.
‘‘We’re in this with you, together,’’ Biden said.
Ukraine has been powerless to prevent Russian troops from taking control of Crimea, which President Vladimir Putin formally annexed Tuesday with the stroke of a pen. Crimea’s absorption came after a hastily organized referendum in which the population overwhelmingly, albeit under conditions akin to martial law, voted in favor of seceding from Ukraine and joining Russia.
Russia’s Constitutional Court chairman, Valery Zorkin, said Wednesday the treaty signed by Putin has been ruled valid, meaning it now only requires ratification by the Russian parliament.
On Wednesday morning, militiamen under apparent Russian command barged their way into Ukraine’s naval headquarters in Sevastopol, detaining the head of Ukraine’s navy and seizing the facility.
The incursion, which Ukraine’s Defense Ministry described as being led by a self-described local defense force, Cossacks, and ‘‘aggressive women,’’ proceeded with no resistance.
Upon gaining entrance to the base, the storming party raised a Russian flag on the headquarters square.
The unarmed militiamen waited for an hour on the square and, following the arrival of the commander of the Russian Black Sea Fleet, they took over the building.
By afternoon, they were in full control of the naval headquarters, a set of three-story white concrete buildings with blue trim.
The Ukrainian Defense Ministry said Rear Admiral Sergei Haiduk was detained and a news agency close to the Russian-backed local authorities reported that he had been summoned for questioning by prosecutors.
Later in the day, Russian Defense Minister Sergei Shoigu ordered the Crimean authorities to release Haiduk.
Andriy Parubiy, secretary of Ukraine’s National Security and Defense Council, said the government was drawing up plans to evacuate its outnumbered troops from Crimea back to the mainland and will seek United Nations support to turn the peninsula into a demilitarized zone.
‘‘We are working out a plan of action so that we can transfer not just servicemen, but first of all members of their family who are in Crimea, quickly and effectively to mainland Ukraine,’’ Parubiy said.
Parubiy also said Ukraine would hold military maneuvers with the United States and Britain, signatories, along with Russia, of the 1994 Budapest Memorandum. He provided no details.
In Washington, the Pentagon said it would participate as planned in a multinational military exercise this summer in Ukraine. Dubbed ‘‘Rapid Trident,’’ the ground maneuvers have been held annually for a number of years with forces from Britain and other NATO countries and Ukraine, which has a partner relationship with NATO but is not a member.
The Pentagon gave no details on the number of US forces expected to participate or when the exercises would be held. Last year, the two-week maneuvers involving 17 nations were held in July.