French President Francois Hollande warned against the risks of rising nationalism in his last New Year address ahead of the election of his successor next spring.
Mr Hollande, who said this month he would not seek a second term in 2017, defended his legacy as president.
He addressed the policies of the anti-immigration and anti-euro National Front, whose leader Marine Le Pen is set to make it to the second round of the election, if recent polls are correct.
"There are periods in history when everything may change dramatically. We're in one of them," Mr Hollande said an address that was broadcast on French television.
"How can we imagine our country being curled up behind walls, reduced to its internal market, going back to its national currency and, on top of that, discriminating between its own children according to their origins?" he said.
Mr Hollande, who did not directly name the FN, mentioned British voters' decision in June to leave the European Union, and the US presidential election won by Donald Trump in November, as events that demonstrated that democracy, freedom and peace were "vulnerable and reversible".
He also warned against the calling into question of the 2015 Paris agreement on climate change.
"France will not let anybody or any state, be it the biggest one, call into question this major achievement of the international community."
US President-elect Trump has called global warming a hoax and has promised to quit the Paris Agreement, which was strongly supported by outgoing Democratic President Barack Obama.
Earlier, German Chancellor Angela Merkel called on Germans to hold firm to democratic values in the face of jihadist terror, urging them to counter "murderers who are full of hate" with compassion and cohesion.
In her New Year's address delivered less than two weeks after a Tunisian suspect rammed a truck into a crowded Christmas market in Berlin, killing 12 people, Ms Merkel acknowledged it was "bitter and sickening" that the attack and others in July were carried out by asylum seekers.
Nevertheless, she defended her decision in September 2015 to let in tens of thousands fleeing war from mostly Arab and Muslim nations.
"When we look at the images of bombed out Aleppo in Syria, we have to say once again how important and right it was for us to have helped those who needed our protection to find their way here and to integrate," she said.
Ms Merkel said it was through such values of humanity and openness that Germany should face down those who espouse hate.
"As we go on with our lives and work, we tell the terrorists: You are murderers full of hate, but you will not determine how we live and want to live. We are free, compassionate and open," she said.
The Chancellor has been under fire over her liberal refugee policy, as the arrival of around a million people over the past two years has deeply polarised society.
Two other attacks carried out in July by asylum seekers, and the 19 December assault, have emboldened right-wing populist critics.
The German leader promised that the government will in 2017 "swiftly put in place and implement any necessary political or legal changes" to close down any security gaps, after the Berlin truck attack exposed serious failures.
But she cautioned against placing certain groups of people under a blanket of suspicion.
Without naming populists, Ms Merkel hit out at those who she said present a "distorted" picture of democracy.
But she said the system is "strong, it allows everyone to act, participate.
"It accepts, no, it demands contradictions and criticisms.
"Criticism that peacefully and respects individuals, that seek solutions and compromises and does not exclude entire groups," she said, urging politicians not to forget these guiding principles in the run-up to elections in 2017.