Bulgarian president Rosen Plevneliev during his interview with the Observer. Photograph: Johann Brandstatter

The president of Bulgaria has made a stinging intervention in the UK's immigration debate, attacking what he calls David Cameron's attempts to pander to nationalists – and warning the PM to consider how history will judge him.

In an exclusive interview with the Observer, less than two weeks before the lifting of all restrictions on Bulgarians and Romanians seeking work in the UK, Rosen Plevneliev called for Britain to stay true to its legacy as "a great global power that pioneered integration" and not play on people's fears. In a direct warning to Cameron, he said: "Isolating Britain and damaging Britain's reputation is not the right history to write."

In recent weeks, the British government has rushed through a series of changes to its welfare system and even stepped in to temporarily prevent Bulgarians and Romanians from receiving student loans, before the lifting of immigration restrictions on 1 January.

Plevneliev, who was elected president two years ago, said the forecasts were wrong and that it was up to mainstream politicians to fight those who played on people's fears at a time of economic trouble rather than be led by them, adding: "Bulgarian people are raising a lot of questions today about the democratic, tolerant and humane British society. Are we in Great Britain today writing a history of a switch to isolation, nationalism and short-term political approaches?"

"Of course, Great Britain will make its planning and will take its decisions. But some of them could be right, some of them could be wrong. Some of them are bold and some of them are, I would say, not long-term-orientated decisions."

Plevneliev added: "Politicians should be ready to say the inconvenient truth and fight for unpleasant but necessary decisions which, in the short term, will bring our ratings down but, in the long term, preserve our values and keep the history of our proud tolerant nations as they are."

The president, who said he now had concerns for the safety of Bulgarians already in the UK, revealed he had confronted Cameron at an EU summit in Vilnius, Lithuania, at the end of last month, demanding an explanation of the British government's "actions, language and plans". Plevneliev said he had received assurances that his citizens would not be discriminated against. "I said, 'Thank you so much for sharing with me your plans, David. Of course, politicians are judged by what they do and not by what they say'."

The president said he feared that poll results for Ukip and its leader Nigel Farage were forcing Cameron into acting in the Conservative party's short-term interests and against those of the UK.

He said: "Let's make sure that what was done in the 20th century, those old-fashioned politics of building walls and iron curtains, will remain in the 20th century. We should learn from the mistakes of this century and understand that every one of us, no matter whether Bulgaria or Great Britain, is weak when he is isolated. The 21st century is about not building walls, but bringing them down, linking peoples, cultures, economies, industry."

Plevneliev said Cameron should consider how history would judge him and forecast that, across the continent, the coming elections for the European parliament would be a clash of those who are "for Europe and against Europe".

He said: "Mr Cameron should address the daily agenda of British politics. But he should never forget that a politician is remembered in history not with the everyday business. A politician is written in history with a maximum of one or two sentences. The judgment comes years later and probably from the next generation. Prime ministers and presidents should make everyday decisions but never forget long-term priorities and values."

In comments that will inevitably be controversial, Plevneliev also claimed Britain could learn from how Bulgaria had adapted to the first wave of immigrants in its modern history, with some 11,000 people arriving from war-torn countries in Africa and the Middle East in the last two years.

He said: "We might even be able to give a lesson to Great Britain. As a country that is not so rich and not so powerful, we are trying to understand not so much how many could come to Bulgaria but how we can integrate them."