SEVASTOPOL, Crimea — Bowing to the reality of the Russian military occupation of Crimea a day after Russia announced it was annexing the disputed peninsula, the Ukrainian government said on Wednesday that it had drawn up plans to evacuate all of its military personnel and their families and was prepared to relocate as many as 25,000 of them to mainland Ukraine.

Thousands of Ukrainian soldiers and sailors have been trapped on bases and other installations here for more than two weeks, surrounded by heavily armed Russian forces and loosely organized local militia.

While the provisional government in Kiev has insisted that Russia’s annexation of Crimea is illegal and has appealed to international supporters for help, the evacuation announcement by the head of the national security council, Andriy Parubiy, effectively amounted to a surrender of Crimea, at least from a military standpoint.

It came hours after militiamen, backed by Russian forces, seized the headquarters of the Ukrainian Navy in Sevastopol and detained its commander, in what appeared to be the start of a concerted effort to oust the Ukrainian armed forces from outposts throughout the peninsula.