President Michael D Higgins has said the growth in populist politics in Europe and America poses huge challenges for democracy.
He made the remarks in an address to the members of the Scottish Parliament in Edinburgh.
President Higgins, who is accompanied by his wife Sabina, is on a four-day official visit to Scotland.
Much of the debate in the Scottish Parliament in recent days has centred on the referendum result that saw UK vote to leave the European Union.
The President said the vote showed the importance of the democratic system.
However, he said the values underpinning that system are being challenged by rising populism in Europe and America.
President Higgins said the response must be an informed and tolerant debate.
He told the parliament that the challenge was to do democracy better and he warned of the dangers of divisive debates.
Such debates were, he said, often just thinly veiled hate or racism.
President Higgins also reflected on the killing of British Labour MP Joe Cox.
He said politicians everywhere owed it to her memory to strengthen democracy and not bend to the politics of fear.
This afternoon, President Higgins will speak about the legacy of James Connolly at a gathering in the University of Edinburgh.
Scottish First Minister Nicola Sturgeon, who met the President earlier in the week, is in Brussels today for talks with the president of the European Parliament and with European Commission officials.