President Obama leaves Nato dinner at Cardiff Castle
US President Barack Obama has left Cardiff Castle after a working dinner of world leaders which closed the first day of the Nato Wales Summit.
The president left the castle in a cavalcade just before midnight.
Earlier, hundreds of people gathered outside to greet the world leaders, including Prime Minister David Cameron and German Chancellor Angela Merkel.
The dinner was the final event in a day when the eyes of the world were on Wales for the historic summit.
The talks in Newport have brought together more than 60 heads of state and government.
All Nato's 28 member countries were represented at the summit, with 4,000 delegates attending amid a security operation unprecedented in Britain.
The summit is the first time the UK has hosted a Nato summit since Margaret Thatcher was still the British leader in 1990.
Police said three people had been arrested in Cardiff during a demonstration outside the castle on Thursday night, which was held to oppose the summit.
At its peak, about 350 campaigners took part in the protest and there were some minor skirmishes.
It was the second demonstration of the day after 250 people marched from Newport to the Coldra roundabout to the summit entrance, but again the numbers were lower than expected.
Earlier on Thursday the Prince of Wales hosted a reception at the Celtic Manor Resort in Newport, after a trip to see the Royal Navy's new warship in Cardiff Bay.
The event was held to promote Wales and thank the community for its hospitality.
Opening the summit's first session, Nato Secretary General Anders Fogh Rasmussen, thanked Wales for its hospitality and said "the world has truly come to Wales".
Ukraine, Afghanistan, and the future of the Nato alliance were at the top of the agenda for politicians and diplomats.
Leaders criticised Russia for its "destabilising" influence on the crisis in eastern Ukraine.
Welcoming delegates to the summit UK Prime Minister David Cameron said: "As Prime Minister of the United Kingdom, I am incredibly proud to have this opportunity to showcase all that Wales has to offer.
"The stunning countryside here behind us. The brilliance of Welsh industry. And, above all, the warm welcome of the Welsh people."
Barack Obama started his visit as the first serving US President to visit Wales with a trip to Mount Pleasant Primary School in Rogerstone, Newport, with Mr Cameron.
As the 22-car convoy carrying the two leaders swept into the school it was greeted with cheers by a large crowd of well-wishers, many carrying Welsh and US flags.
They joined a lesson both greeting children with "Bore da" - good morning in Welsh.
President Obama and Mr Cameron then returned to the Celtic Manor Resort where they were greeted by Wales' First Minister Carwyn Jones, and joined VIPs and delegates for the official summit start.
The prime minister said holding such a crucial summit was a great opportunity for Wales.
Mr Cameron said: "I think it's a great moment to put the best face of Wales forward - the brilliance of Welsh industry, of Welsh people - a great place to locate, a great place to come. It's going to be a brilliant advertisement for Wales.
"There are lots of ways of promoting Wales and Welsh businesses and we should look at all of them, but this is one way we can give a real boost to Wales."
"The largest gathering of international leaders ever to take place in the UK is starting in our home country here and now," said Wales' First Minister Carwyn Jones.
"The Nato Wales Summit is an exciting and historic moment for our country and I am confident we will shine on the world stage."
Nearly 10,000 police officers from 43 forces across England and Wales have been duty as part of a major security operation.
Warships from the 28 Nato member states were docked at Cardiff Bay.
On Friday an aerial display by military jets from nine countries, including the RAF's Red Arrows, will fly over Cardiff Bay at around 08:30 BST and head to Newport around 15 minutes later.
Talks will continue for much of Friday until the summit is expected to conclude around 15:00 BST.Wales Nato Summit 2014 in numbers