Richard B. Parker, 87, a career Foreign Service officer and Middle East expert who served in the 1970s as the U.S. ambassador to Algeria, Lebanon and Morocco, died Jan. 7 at the Grand Oaks retirement facility in Washington. He had vascular disease.

Mr. Parker retired from the State Department in 1980 after more than 30 years of service. He also held diplomatic posts in Australia, Israel, Jordan and Egypt.

In retirement, he was a diplomat-in-residence at the University of Virginia, where he taught classes on foreign policy in the Arab world and served as an editor of the Middle East Journal.

The depth of his expertise in Arab culture led him to write scores of academic papers on a variety of topics, including Lebanese proverbs and Arabic graffiti in Middle Eastern men's restrooms.

Mr. Parker's interest in the Middle East began soon after his release from a prisoner-of-war camp during World War II.

An Army antitank platoon officer, Mr. Parker was captured by German soldiers after his unit was overwhelmed during the Battle of the Bulge.

He was sent to a prison camp in occupied Poland and spent 34 days in captivity before the camp was liberated by Russian soldiers.

During his repatriation, Mr. Parker traveled through the present-day Ukrainian city of Odessa, the Turkish Straits and Port Said in Egypt. He became fascinated with the majesty of Istanbul's architecture and the intricacies of Arab culture.

He joined the Foreign Service in 1949 and specialized as an Arabist. He spoke Arabic with native fluency and became a respected adviser on Middle Eastern politics to Presidents Gerald Ford and Jimmy Carter. In his diplomatic assessments, Mr. Parker was known to write with an acerbic wit and offer his opinions with blunt honesty.

In 1974, he became the first ambassador to Algeria since the United States severed formal diplomatic relations with that country seven years earlier. Mr. Parker was selected to become the U.S. ambassador to Lebanon in 1977 after the assassination of his predecessor, Francis E. Meloy Jr. His last diplomatic position came in 1978 as ambassador to Morocco.

In a 2004 interview with Foreign Service Journal, Mr. Parker said his time in Morocco was cut short by the country's monarch, who had survived two coup attempts during the ambassador's tenure.

"The king was never fully persuaded that we weren't involved somehow," Mr. Parker said, noting that King Hassan II had told him "relations would not improve so long as I was there."

Mr. Parker said he had a similar experience earlier in his career in Egypt, when President Gamal Abdel Nasser ordered his deportation from the country.

"He apparently thought I was the real CIA station chief and was personally responsible for all the bad things he thought the Americans had done to Egypt," Mr. Parker said. "The Egyptians later explained that they thought I had not acted like a diplomat. I'm not sure what that meant but have taken it as an unintended compliment."

Richard Bordeaux Parker was born July 3, 1923, in the Philippines, where his father served as an Army officer.

He graduated from Kansas State University in 1947 and received a master's degree a year later.

Mr. Parker wrote a number of books on the Middle East, including "Uncle Sam in Barbary: A Diplomatic History" (2004), which recounted America's first international hostage crisis, when North African pirates captured two U.S. ships off the coast of Portugal in 1785.

According to Mr. Parker's book, the incident represented the country's first challenge in the Arab world and spurred the formation of the U.S. Navy.

The work won the American Academy of Diplomacy's Douglas Dillon Award in 2004 for distinguished writing.

As an amateur photographer, Mr. Parker took hundreds of pictures of Islamic monuments during his travels in the Middle East. More than 650 black-and-white prints and negatives of Mr. Parker's work from Syria, Jordan, Egypt and Lebanon are part of the Smithsonian Institution's Asian art collection at the Freer Gallery of Art and the Arthur M. Sackler Gallery.

Survivors include his wife of 66 years, Jeanne Jaccard Parker of Washington; four children, Alison Kenway of Portland, Maine, Jeff Parker of Newton, Mass., Jill Parker of Arlington County and Richard "Jack" Parker of Danvers, Mass.; nine grandchildren; and two great-grandchildren.