Finland's new president Alexander Stubb said Friday he was ready to take "difficult decisions" to protect the country's security, following its accession to NATO amid tension with Russia.

Addressing parliament at his swearing-in following his February election victory, the conservative former prime minister warned that Russia's invasion of Ukraine marked a dangerous new era of division.

"The main task of the president of the republic is to ensure under all circumstances that peace is maintained in Finland," he told parliament at his swearing-in.

"I promise to do that, but if things get tough, I am also prepared to take difficult decisions to ensure the security of our country."

As head of state for a six-year term, Stubb will be in charge of foreign policy in co-operation with the government.

The role gained fresh importance after Russia invaded Ukraine in 2022, raising tensions with Finland along its 1,340-kilometre (830-mile) border with Russia.

In response to the assault, Finland joined the western military alliance NATO in April 2023.

It accused Russia of orchestrating an influx of migrants across its eastern border in August. Stubb was among the supporters of its decision to then close the border in November -- a measure scheduled to last at least until April 14.

"The post-Cold War era is over. It was ended by Russia's attack on Ukraine," Stubb said in his investiture speech.

"The things that were meant to bring us together -- free movement, trade, technology, energy, information and currency -- are tearing us apart," he added.

"The tools of cooperation have been weaponised. At the same time cooperation in Europe has been strengthened, and that is good."

Stubb's predecessor as president, Sauli Niinisto, was reputed to have met more often than any other European leader with Russia's President Vladimir Putin.