Queen Elizabeth II shook hands with former IRA commander Martin McGuinness on Wednesday in a highly symbolic moment in the Northern Ireland peace process.
The initial handshake between the queen and McGuinness, who is now deputy first minister of the British province, took place behind closed doors in a Belfast theatre.
The two then shook hands a second time for the cameras as the queen left the building.
McGuinness held the monarch's hand for a few moments and she smiled as he spoke to her in Irish, telling her the words meant: "Goodbye and God speed."
He told reporters later the meeting had been "very nice", without elaborating.
Later crowds of flag-waving supporters lined the route to Northern Ireland's parliament buildings, Stormont, as the queen and her husband Prince Philip joined 22,000 guests for a garden party before leaving for home.
They arrived in an open-topped vehicle -- another sign of the improved security situation in the province.
The handshake is seen as an important milestone in Anglo-Irish relations after three decades of sectarian violence, known as "The Troubles", which largely ended with the Good Friday peace agreement in 1998.
A spokesman for British Prime Minister David Cameron said the McGuinness handshake had "taken relations between the two countries to a new level".
It came on the second day of the queen's visit to the province, which on Tuesday took her to Enniskillen, the scene of a notorious 1987 Irish Republican Army bombing which killed 11 people.
McGuinness was a senior commander in the IRA when the paramilitary group killed the queen's cousin Louis Mountbatten in 1979 by bombing his boat while he was on holiday in County Sligo in the Republic of Ireland.
His Sinn Fein party, the political wing of the now-defunct IRA, continues to reject British rule of Northern Ireland.
In the eyes of republicans, the queen is commander-in-chief of an army that killed 13 people during a civil rights march in 1972, an event known as Bloody Sunday.
Sinn Fein President Gerry Adams said the meeting had brought the process of relationship building "onto a new plane."
Earlier this week McGuinness said that by shaking the queen's hand he would be "shaking the hands of hundreds of thousands of unionists".
The first handshake came in a brief meeting when they were joined by Prince Philip, Northern Ireland's unionist first minister Peter Robinson, Irish President Michael D Higgins and his wife Sabina.
It took place on the sidelines of a cross-border charity arts event at the Lyric Theatre, in a room with curtains drawn.
Sinn Fein said McGuinness told the queen that their encounter, which comes a year after she made a landmark visit to the Republic of Ireland, was a "powerful signal that peace-building requires leadership".
In their meeting, McGuinness reportedly commented on the queen's May 2011 visit to Dublin and the remarks she made then expressing her sympathy for victims on both sides of the conflict.
A Sinn Fein spokesman said: "He emphasised the need to acknowledge the pain of all victims of the conflict and their families."
President Higgins said the meeting marked "another important step on the journey to reconciliation on this island."
Britain's Northern Ireland Secretary Owen Paterson said the event signalled "a shared future", noting that a few years ago "none of this could have happened."
"This is a moment in Northern Ireland's history that will shine in our collective memory," he added.
Signs of the former tensions resurfaced overnight, however, when around 100 missile-throwing youths clashed with police in Belfast, injuring nine officers.
Police said more than 20 petrol bombs were thrown in the Broadway area of the city.
The royal couple also visited the Titanic Belfast visitor centre Wednesday, near where the ill-fated liner was built.
The attraction opened earlier this year for the centenary of the sinking of the Titanic on its maiden voyage from Southampton to New York when 1,500 people died.
The two-day trip was part of the queen's diamond jubilee celebrations, marking her 60th year on the throne, but Buckingham Palace stressed that the McGuinness meeting was not part of those celebrations.