By Joseph Nasr

BERLIN (Reuters) - Islamist terrorism is the biggest test facing Germany, Chancellor Angela Merkel said on Saturday in a New Year's address to the nation, and vowed to introduce laws that improve security after a deadly attack before Christmas in Berlin.

Merkel, seeking a fourth term as chancellor in 2017, described 2016 as a year that gave many the impression that the world had "turned upside down". She urged Germans to shun populism and said Germany should take a leading role in addressing the many challenges facing the European Union.

"Many attach to 2016 the feeling that the world had turned upside down or that what for long had been held as an achievement is now being questioned. The European Union for example," Merkel said.

"Or equally parliamentary democracy, which allegedly is not caring for the interests of the citizens but is only serving the interests of a few. What a distortion," she said in a veiled reference to claims by the far-right party Alternative for Germany (AfD) that is stealing votes from her conservatives.

Ahead of the 2017 election, polls put her conservative bloc well ahead of rivals but a fractured electoral landscape risks complicating the coalition arithmetic.

"Election year 2017: For Merkel, nothing is certain any more", ran a headline in Saturday's edition of mass-selling daily Bild.

The paper wrote that for an increasing number of voters the chancellor, 62, no longer appeared unassailable.

ANCHOR OF STABILITY

Liberals across the Atlantic have hailed Merkel as an anchor of stability and reason in a year that saw Donald Trump elected as U.S. president, Britain vote to leave the EU and U.S-Russia relations deteriorate to Cold War levels.

In her address, Merkel compared Brexit to a "deep incision" and said that even though the EU was "slow and arduous", its member states should focus on common interests that transcend national benefits.

"And, yes, Europe should focus on what can really be better than the national state," Merkel said. "But we Germans should never be led to believe that each could have a better future by going it alone."

Story continues

She was alluding again to the populist AfD, which wants Germany to leave the EU and shut its borders to asylum seekers, more than one million of whom arrived in the country this year and last.

The record number of migrants has hurt Merkel's popularity and fueled support for the AfD, which says Islam is incompatible with the German constitution. But her conservatives are still expected to win the general election in nine months.

Merkel has made security the main election platform for her Christian Democrats (CDU).

In her speech, she said the government would introduce measures to improve security after a failed Tunisian asylum seeker drove a truck into a Christmas market in the capital on Dec. 19, killing 12 people in the name of Islamic State.

He was shot dead by Italian police in Milan on Dec. 23 and investigators are trying to determine whether he had accomplices.

(Additional reporting by Paul Carrel, Editing by Stephen Powell)