The deadly attack on four U.S. diplomats in Libya has highlighted the risks foreign service officers face in the field, particularly in volatile countries.

If you work in this field, we’d like to hear your stories and concerns.

During a visit to the State Department on Wednesday morning, President Obama spoke to several hundred employees gathered in the courtyard, rallying the staff after Tuesday’s killings at the consulate in Benghazi, Libya. A State Department official relayed the highlights to the White House press pool.

The president, flanked by Secretary of State Hillary Clinton and four other senior State officials, spoke of the importance of the foreign service and how effective it is representing the United States abroad. He also said he understands the value of the foreign service because so much of his childhood was spent abroad, according to the official.

The president praised Ambassador J. Christopher Stevens and the other victims of the Libya attacks. He shook dozens of hands and spoke one-on-one with numerous employees.

When Obama turned to leave, the employees gave him a big round of applause.

Also Wednesday, the American Foreign Service Association, which represents foreign service officers around the world, condemned the attacks as “outrageous and cowardly” and said they underscore the dangers U.S. diplomats face in many postings.

“We oppose intentional efforts to offend religious feelings,” AFSA President Susan R. Johnson said in a statement. “We firmly believe in diplomacy and commitment to sustained dialogue to resolve differences of whatever sort and for better mutual understanding among peoples of differing faiths, ideologies and cultures.”

Sen. Joseph Lieberman (I-Conn.), chairman of a committee that oversees the federal workforce, said Wednesday that service overseas “can be hazardous.”

“A lot of money is spent protecting public servants in dangerous places,” he said. “We will have to look closely at whether we were spending enough protecting employees in Benghazi and Cairo.”

Timothy R. Smith contributed to this report.