Former US presidential candidate Hillary Clinton lauded the “grassroots activism” behind last month’s referendum vote to remove the constitutional ban on abortion and an outcome that represented “the voices and views of the Irish people”.

In a public lecture on a visit at Trinity College Dublin to receive a honorary degree, the former US secretary of state delivered a call to action to young people and greater engagement in politics.

During her 30-minute address, Mrs Clinton told an audience of about 400 in a lecture theatre that she had followed last month’s referendum and “saw Irish people flying home to vote from all over the world”.

“Airports were mini-rallies with cheering and colourful banners greeting citizens who came as far away as from Japan, Australia and, of course, America,” she said.

“On the day of the vote one of the strictest laws in the world was overturned with nearly 87 per cent of 18- to 25-year-olds voting ‘yes.’

“It was an example of a government placing that decision before the people and grassroots activism leading to an outcome that represented the voices and views of the Irish people.”

She made veiled and not-so-veiled references to her two failed runs for the US presidency.

Encouraging students to “think for themselves and to take risks”, she quoted the words of Trinity graduate Samuel Beckett: “Ever tried. Ever failed. No matter. Try again. Fail again. Fail better.”

“Believe me those are words to live by,” she said, drawing laughter from her audience.

Mrs Clinton spoke of past visits to Dublin, including stopping “for a pint” at a pub off Grafton Street.

She touched on the importance of the Belfast Agreement that she and her husband, former president Bill Clinton, helped nurture and the risks posed to it by the UK’s withdrawal from the EU.

“No matter the outcome of these discussions, Brexit should not be allowed to undermine the peace that people voted, fought and even died for,” she said.

The former US first lady gave a wide-ranging lecture and follow-up interview with former president of Ireland Mary Robinson.

A lot had happened since she last visited Ireland, she said, noting that she became a grandmother twice over.

“And, as you may have heard, I ran for president,” she said, to laughs. “The grandparenting thing worked out great – the other, not exactly as I had thought.”

In a warning of the risks to democracy from rising oppression and authoritarianism, she said: “We’re at a global tipping point,” and that young people will be the most influential group to determine the future.

“We are living through an era when fundamental rights, civic virtue, even facts and reason are under assault like never before,” she said.

On the Trump administration’s separation of illegal immigrant parents from children at the US border with Mexico, Mrs Clinton said “Americans from every political background” had watched “heartbroken and outraged” as immigrant families were “ripped apart”.

“Yet even in this dark hour we are witnessed an outpouring of moral conviction, civic engagement and lasting commitment to stand up for the most vulnerable among us,” she said, praising the millions who have become “unlikely activists” and led the “outcry” that had forced Mr Trump to reverse his policy.

“The fight is far from over,” she said, as more than 2,000 children still had to be reunited with parents.

Mrs Clinton warned against a “rising tide of illiberalism” and condemned Russian president Vladimir Putin for positioning himself as the “leader of an authoritarian, white supremacist and xenophobic movement that wants to break up the EU, weaken America’s traditional alliances and undermine democracy.”

Russian interference in the US election showed that the Kremlin was “a clear and present danger to western democracy”, she said.

In response to questions from Ms Robinson, Mrs Clinton said she loved the idea of the Citizens’ Assembly that recommended the text for last month’s abortion referendum.

Sorcha Ryder, the president of the University Philosophical Society, one of Trinity’s debating societies, asked Mrs Clinton what advice she would give young Irish women aspiring to be leaders.

“First of all, congratulations on being president,” she said, drawing laughter and applause in the audience. “Surrounded by women presidents as I am.”

She advised young women to “go in with their eyes open”.

“There still is a double standard; it is diminishing but it is ubiquitous,” Mrs Clinton told her.

Outside the lecture, a large group of demonstrators protested at the US politician’s “horrifying record” as first lady and secretary of state for her support of Israel and Saudi Arabia.

“We feel that our campus and our campus community is being degraded by giving an honorary degree to someone like Hillary Clinton,” said Trinity student Seán Egan, a member of Students for Justice in Palestine.

Elsewhere in Dublin, former FBI director James Comey, the man she claimed “shivved” her in the 2016 presidential election campaign, was also in Dublin for a separate public event.

Mrs Clinton blamed Mr Comey for her election defeat to Mr Trump over his reopening of an investigation into her use of an unsecured email in October 2016 – 11 days before the presidential election.