KYIV, Ukraine (AP) — Russian President Vladimir Putin doubled down Wednesday on his faltering invasion of Ukraine with a declaration of martial law in four illegally annexed regions and preparations within Russia for draconian new restrictions and crackdowns.

Putin’s drastic efforts to tighten his grip on Ukrainians and Russians follow a series of embarrassing setbacks: stinging battlefield defeats, sabotage and troubles with his troop mobilization.

The martial law order belies the Kremlin’s attempts to portray life in the annexed regions as returning to normal. The reality is that a military administration has replaced civilian leaders in the southern city of Kherson and a mass evacuation from the city is underway as a Ukrainian counteroffensive grinds on.

The battle for Kherson, a city of more than 250,000 people with key industries and a major port, is a pivotal moment for Ukraine and Russia heading into winter, when front lines could largely freeze for months. It’s the largest city Russia has held during the war, which began Feb. 24.

A trickle of evacuations from the city in recent days has become a flood. Local officials said Wednesday that 5,000 had left out of an expected 60,000. Russian state television showed residents crowding on the banks of the Dnieper River, many with small children, to cross by boats to the east — and, from there, deeper into Russian-controlled territory.

In announcing martial law effective Thursday, Putin told his Security Council, “We are working to solve very difficult large-scale tasks to ensure Russia’s security and safe future.”

Putin’s army is under growing pressure from a Ukrainian counteroffensive that has clawed back territory. The Russian leader is also faltering after the sabotage of a strategically important bridge linking Russia with Crimea, assassinations of Kremlin-installed officials in Kherson and mistakes he himself has admitted in his partial troop mobilization.

Putin’s martial law declaration authorized the creation of civil defense forces; the potential imposition of curfews; restrictions on travel and public gatherings; tighter censorship; and broader law enforcement powers in Kherson and the other annexed regions of Donetsk, Luhansk and Zaporizhzhia.

In an ominous move, Putin opened the door for restrictive measures to be extended across Russia, too. That may lead to a tougher crackdown on dissent than the current dispersal of antiwar protests and jailing of people making statements or providing information about the fighting that differs from the official line.

The severity of new restrictions inside Russia depends on proximity to Ukraine.

Putin put areas nearest Ukraine on medium alert, including annexed Crimea, Krasnodar, Belgorod, Bryansk, Kursk, Rostov. Local leaders are authorized to organize territorial defense, ensure public order and safety, safeguard transportation, communication and energy facilities, and use these resources to help meet the Russian military’s needs.

Leaders in these border areas can also carry out resettlements of residents and restrict freedom of movement. Leaders in other areas have been granted similar powers, depending on their alert level.

In the Kherson region, Ukrainian forces have pushed back Russian positions on the west bank of the Dnieper River. By pulling civilians out and fortifying positions in the region’s main city, which backs onto the river, Russian forces appear to be hoping that the wide, deep waters will serve as a natural barrier against the Ukrainian advance.

Russia has said the movement of Ukrainians to Russia or Russian-controlled territory is voluntary, but in many cases, they have no other routes out, and no other choice.

Under martial law, authorities can force evacuations. Ukraine’s national security chief, Oleksiy Danilov, said on Twitter that Putin’s declaration is “preparation for the mass deportation of the Ukrainian population to the depressed regions of Russia to change the ethnic composition of the occupied territory.”

For months, reports have circulated of forced deportations, and an Associated Press investigation found that Russian officials deported thousands of Ukrainian children to be raised as Russian.

Ukraine’s Foreign Ministry said Putin’s decree is illegal, calling it part of his effort “to deprive the inhabitants of the temporarily occupied territories of Ukraine of even basic human rights.”

Russian authorities played up fears of an attack on Kherson, seemingly to persuade residents to leave. Text messages warned residents to expect shelling, Russian state media reported.

One resident reached by phone described military vehicles leaving the city, Moscow-installed authorities scrambling to load documents onto trucks, and thousands of people lining up for ferries and buses.

“It looks more like a panic rather than an organized evacuation. People are buying the last remaining groceries in grocery shops and are running to the Kherson river port, where thousands of people are already waiting,” the resident, Konstantin, said. The AP is withholding his family name, as he requested, for his safety.

“People are scared by talk of explosions, missiles and a possible blockade of the city,” he added.

Leaflets told evacuees they could take two large suitcases, medicine and food for a few days.

Andriy Yermak, head of the Ukrainian presidential office, called the evacuation “a propaganda show” and said Russia’s claims that Kyiv’s forces might shell Kherson “a rather primitive tactic, given that the armed forces do not fire at Ukrainian cities.”

Ukrainian military analyst Oleh Zhdanov said the operation could presage intense fighting and “the harshest” tactics from Russia’s new commander for Ukraine, Gen. Sergei Surovikin.

“They are prepared to wipe the city from the face of the Earth but not give it back to the Ukrainians,” Zhdanov said in an interview.

In a rare acknowledgement of the pressure that Kyiv’s troops are exerting, Surovikin described the Kherson situation as “very difficult.” Russian bloggers interpreted the comments as a warning of a possible Kremlin pullback. Surovikin claimed that Ukrainian forces were planning to destroy a hydroelectric facility, which local officials said would flood part of Kherson.

Incapable of holding all the territory it has seized and struggling with manpower and equipment losses, Russia has stepped up air bombardments, with a scorched-earth campaign targeting Ukrainian power plants and other key infrastructure. Russia has also increased its use of weaponized Iranian drones to hit apartment buildings and other civilian targets.

Russia launched numerous missiles over Ukraine on Wednesday. Ukrainian authorities said they shot down four cruise missiles and 10 Iranian drones. Energy facilities were hit in the Vinnytsia and Ivano-Frankivsk regions.

Air raid sirens blared in the Ukrainian capital, Kyiv, sending many people into metro stations for shelter. Mayor Vitali Klitschko announced the city would start seasonal centralized heating on Thursday at lower temperatures than normal to conserve energy.

A Ukrainian energy official, Oleksandr Kharchenko reported Wednesday that 40% of the country’s electric system had been severely damaged. Authorities warned all residents to cut consumption and said power supply would be reduced Thursday to prevent blackouts. One area where power and water were reported knocked out due to overnight shelling was Enerhodar. The southern city is next to the Zaporizhzhia nuclear power plant, which is one of the war’s most worrisome flashpoints.

Missiles severely damaged an energy facility near Zelenskyy’s hometown, Kryvyi Rih, a city in south-central Ukraine, cutting power to villages, towns and to one city district, the regional governor reported.

___

Karmanau reported from Tallinn, Estonia.

___

Follow AP’s coverage of the war in Ukraine: https://apnews.com/hub/russia-ukraine