Four Americans killed in an attack on the U.S. Consulate in Benghazi, Libya, earlier this week. They were returned to the United States and honored in a somber ceremony at Joint Base Andrews, Md., on Friday. Click below for more details and video.

Eloisa Melo

Visit NBCNews.com for breaking news, world news, and news about the economy

The bodies of four Americans killed in an attack on the U.S. Consulate in Benghazi, Libya, earlier in the week were returned to the United States and honored in a somber ceremony at Joint Base Andrews, Md., on Friday.

President Barack Obama arrived shortly before the transfer ceremony honoring the victims — U.S. Ambassador Chris Stevens, information management officer Sean Smith and security personnel Tyrone Woods and Glen Doherty.

Marines carried flag-draped coffins bearing the remains of the four across the tarmac and placed them before a gathering of family, friends, White House officials and high-level State Department personnel. In total, 800 to 1,000 were in attendance, an Air Force official said.

After a moment of silence and a prayer, Secretary of State Hillary Clinton eulogized each of the victims.

“We owe it to those four men to continue the long, hard work of diplomacy,” Clinton said.

“May God bless them, and grant their families peace and solace, and may God continue to bless the United States of America,” Clinton said, before making way for comments by Obama.

The president said the men embodied and lived “the American ideal,” embracing what he called “the fundamental American belief that we can leave this world a little better than before.”

In honoring the fallen Americans, he also made a case for continued diplomatic and aid commitments to allies in the Middle East.

“Even as voices of suspicion and mistrust seek to divide countries and cultures from one another, the United States of America will never retreat from the world. We will never stop working for the dignity and freedom that every person deserves. … That’s the spirit that sets us apart from other nations. That was their work in Benghazi and this is the work we will carry on.”

After the national anthem and a prayer, “America the Beautiful” was played as the caskets were loaded into waiting hearses, which then departed.

NBC News