Donald Trump called Westminster Abbey a "special place" following his visit, in which the Dean of Westminster appealed for vision, understanding and integrity during his prayer.
Mr Trump was welcomed by the Very Reverend Dr John Hall and the Duke of York, and remained solemn as he laid a wreath at the Grave of the Unknown Warrior.
Joined by the First Lady Melania, daughter Ivanka and son-in-law Jared Kushner in his first visit to the abbey, the president described it as an honour in a message in the distinguished visitors’ book.
Dr Hall led prayers at the grave on Monday afternoon.
Stood between the dean and wife Melania, Mr Trump kept his eyes closed as the prayer was delivered, reaching down to the touch the wreath as it was placed on the grave by two marines.
He and Melania stood side by side as a choir sung behind them.
The president marvelled at the age of the building – which is celebrating its 750th anniversary this year – during a tour of the abbey.
After turning to his wife and relaying it was built in 1269, Mr Trump asked the dean if the Queen would attend the anniversary celebrations.
White House Press Secretary Sarah Sanders and adviser Kellyanne Conway also joined the delegation as they walked through the abbey.
The dean, who remained tight-lipped about what he and the president discussed, said he was “friendly” and they had a “good conversation”.
“He was very interested, very engaged,” Dr Hall said after Mr Trump’s departure.
“This year we’re celebrating the 750th anniversary of the current building so I think he was interested in the age.”
Asked about whether or not Mr Trump said Amen following the prayers, he said: "Some people said Amen, some people didn’t. He was praying with us."
In his prayer, the dean thanked God for the "peace and friendship" binding the UK and the US.
Speaking about the heads of the two states, he said: "Grant them as symbols of loyalty and unity for all their people; inspire their governments with vision, understanding and integrity, give to the nations’ legislatures and judiciaries wisdom and skill, imagination and energy."
Before leaving, Mr Trump wrote in the distinguished visitors’ book, which he signed under the Congressional Medal of Honour in the abbey’s nave.
The message, written in black marker pen, said: “Thank you so much.
“This has been a great honor. Special place.”
He thanked the dean and other members of the congregation as he left to join the Prince of Wales and Duchess of Cornwall for tea at Clarence House.