Martial law was imposed in parts of Ukraine on Wednesday in response to rising tensions with Russia.

Parliament on Monday voted in favor of enacting 30 days of martial law, but President Petro Poroshenko says the government will use its new powers only in the event of "Russian military aggression."

Martial law allows the government to ban protests, detain foreigners, seize private property, censor the media, and stop elections.

Poroshenko said he was responding to an "act of armed aggression" after Russia fired at and captured three Ukrainian vessels in the Azov Sea on Sunday.

Poroshenko promised not to restrict citizens' rights and freedoms or introduce censorship.

Parts of Ukraine are now under martial law, giving authorities sweeping powers to ban protest, seize property, and lock up foreigners.

The emergency powers were granted to Ukrainian authorities by the country's parliament in response to an escalating conflict which Russia, which reached a climax in a short-lived naval battle in the Sea of Azov.

Members of parliament in the capital of Kiev voted on Monday to impose martial law in parts of the country beginning Wednesday morning. They granted powers to the government of President Petro Poroshenko after he argued that they were necessary to protect the "state sovereignty and independence of Ukraine."

Poroshenko confirmed via his Facebook page on Wednesday that martial law was in effect:

His plea came after Russia's ships attacked and captured three Ukrainian vessels off the coast of Crimea.

Ukraine has considered itself to be at war with Russia since 2014, when pro-Russian militants declared revolutions in two eastern provinces and Russia annexed the Crimean Peninsula.

Martial law will be in place for 30 days beginning Wednesday, parliament decided. It will take effect in 10 of Ukraine's 27 regions, many of which border Russia and the Black and Azov seas.

Speaking in parliament, Poroshenko said martial law would "be applied only in the case of Russian military aggression."

His decree did not specify which restrictions would be put in place, but Ukrainian law grants the authorities sweeping powers. The Ukrainian newspaper Kyiv Post explained more of the potential implications.

They include the seizure of private property, the control of mass media, and the deportation and detention of foreigners.

The law also allows for a ban on protests, elections, and political activities the government views as a security threat.

Poroshenko promised he would not introduce any measures restricting citizens' rights and freedoms or introducing censorship.

"I hope that both politicians and mass media will act responsibly and adequately in the current situation and will not attack Ukraine with the theses borrowed from Russian propagandists," he said.

"There will be no restriction of rights, there will be no restriction of freedoms."

He said in his decree that martial law was needed "to adequately respond to the scaling of the armed aggression of the Russian Federation against Ukraine."

He said that no other legal or constitutional option was sufficient to maintain the country's independence amid escalating tensions with Russia.

Poroshenko addressing parliament on Monday on his proposal to introduce martial law. REUTERS/Valentyn Ogirenko

Russia claims that the ships entered Russian waters illegally and that it fired in response, the Russian state news agency Tass reported, citing the Russian Federal Security Service.

In a statement on Monday, Russia's Foreign Ministry accused Ukraine of carrying out "a well-thought-out provocation that took place in a predetermined place and form."

Read more: Russia confirms it fired at Ukrainian ships in major escalation of Crimea tensions

Poroshenko said in his decree that the country would strengthen its border with Russia, mobilize reserve forces, and boost its counterterrorism and counterintelligence programs.

He first sought 60 days of martial law, but lawmakers settled on a shorter period amid accusations that Poroshenko was looking to interfere with an election in which he has a good chance of losing. Poroshenko denied that the election was his motivation.

Poroshenko also said the declaration was not an act of war and was made exclusively for the defense of Ukraine.

Russia has been steadily increasing its control around the Crimean Peninsula, and the Kerch Strait in the Sea of Azov has been a flashpoint in the conflict between the two countries.

The road-and-rail bridge constructed to connect the Russian mainland with the Crimean Peninsula in the Kerch Strait. REUTERS/Pavel Rebrov

Read more: Russia reopens Kerch Strait to shipping after standoff with Ukraine

Poroshenko called the confrontation an "act of armed aggression" by Russia and called on Russia to release the 24 service members and three vessels it detained.

The European Council's president, Donald Tusk, condemned Russia's actions and urged Moscow to stop provoking Ukraine. "I condemn Russian use of force in Azov Sea," he tweeted.

"Europe will stay united in support of Ukraine."

The narrow Kerch Strait separates Crimea from the Russian mainland. Google Maps

Russia and Ukraine called an emergency session of the UN Security Council on Monday, at which US Ambassador Nikki Haley warned Russia over what she called an "outrageous violation" of Ukrainian sovereignty.

NATO's spokeswoman, Oana Lungescu, wrote on Twitter early Monday morning that the alliance was closely monitoring the situation, and she called for restraint.

"NATO fully supports Ukraine's sovereignty and its territorial integrity, including its navigational rights in its territorial waters," Lungescu tweeted. "We call on Russia to ensure unhindered access to the Ukrainian ports in the Azov Sea, in accordance with international law."

Canada, the UK, Germany, and other countries have condemned Russia, expressing support for Ukraine's sovereignty.

US Secretary of State Mike Pompeo condemned what he called the "aggressive Russian action." He said Russia should return the detained crew members and vessels and "respect Ukraine's sovereignty and territorial integrity within its internationally recognized borders, extending to its territorial waters."