Robert B. Oakley, right, in Mogadishu, Somalia, in January 1993 with Mohammad Farah Aideed. (Scott Applewhite/AP)

Robert B. Oakley, a career diplomat and three-time ambassador with a reputation for shrewdness in Washington and toughness in crisis zones, and who in retirement obtained the release of an American pilot captured during the “Black Hawk Down” incident in Somalia, died Dec. 10 in McLean, Va. He was 83.

The cause was complications from Parkinson’s disease, said his wife, Phyllis E. Oakley, a retired assistant secretary of state and a former spokeswoman for secretary of state George P. Shultz.

Mr. Oakley, who attained the high-ranking title of “career minister,” officially retired in 1991 as the chief American envoy in Pakistan. Thin and with a soft Louisiana drawl, he was regarded as a top troubleshooter in some of the world’s thorniest regions.

He specialized in Africa, the Middle East and South Asia, and his perspective was profoundly shaped by his stint in Vietnam from 1965 to 1967, when he helped draft a Western-style constitution.

He said a Vietnamese journalist once told him: “You know, you Americans look on us as if we were just a basket of crabs. You don’t really care what the crabs are doing in that basket as long as they don’t escape or as long as someone is not stealing the basket away from you.”

Mr. Oakley later added, “I thought then that he had that right. Our motives were often quite selfish even when disguised in very noble terms.”

He headed the State Department’s counterterrorism office from 1984 to 1986, a period marked by a rise in hostage crises and state-sponsored terrorism in the Middle East and Libya. He also served as ambassador to Zaire (now Congo) from 1979 to 1982, to Somalia from 1982 to 1984 and to Pakistan from 1988 to 1991.

“He didn’t wind up in places like Copenhagen, if you get my drift,” Chester A. Crocker, a former assistant secretary of state for African affairs, once told the Los Angeles Times. Instead, Mr. Oakley specialized in “rough duty, places where you spend seven days a week walking through a minefield of ambiguity.”

In difficult jobs, Mr. Oakley’s personal connections to the top echelon of Washington policymakers were invaluable.

He was a Princeton classmate of James A. Baker III, who became secretary of state, and Frank C. Carlucci III, who became secretary of defense. He apprenticed at the National Security Council in the mid-1970s under national security adviser Brent Scowcroft and, from 1977 to 1979, was a deputy to Richard C. Holbrooke, who was then serving as assistant secretary for Far Eastern Affairs.

Mr. Oakley’s portfolio in the 1980s encompassed the Iran-Iraq War; the continued captivity of American soldiers in Lebanon; the passage of arms to the U.S.-supported mujahideen in Afghanistan and the Soviet departure from that country; encouraging the restoration of democracy in Pakistan after long military rule; and maintaining the fragile peace between nuclear-armed archenemies Pakistan and India.

After Carlucci was named national security adviser in 1987 with a mandate to clean house after the Iran-contra scandal, he tapped Mr. Oakley as head of Near East and South Asian Affairs on the National Security Council.

In that role, he helped revive an “activist” policy in the Middle East after the embarrassment of Iran-contra and the earlier American withdrawal from Lebanon after deadly terrorist attacks that struck the U.S. marine barracks in Beirut.

As part of that push, Mr. Oakley helped orchestrate a sizable American naval presence in the Persian Gulf to safeguard Kuwaiti oil tankers during the Iran-Iraq War.

In 1992, Mr. Oakley said Colin Powell, then chairman of the Joint Chiefs of Staff, lured him from retirement to serve as a special U.S. representative to Somalia for President George H.W. Bush.

He went initially to Mogadishu as part of a humanitarian mission to maintain a cease-fire in a country riven by civil war and famine.

Mr. Oakley left in March 1993 and, to his dismay, the American presence deepened under President Bill Clinton into a heavily militarized nation-building endeavor. He said he was an advocate of “tremendous restraint” in Somalia, not becoming a “party to the conflict.”

That October, Clinton called on his services after the Battle of Mogadishu, in which 18 Americans were killed and dead U.S. soldiers were dragged through the streets. A downed Black Hawk helicopter pilot, Michael Durant, was captured by loyalists of the warlord Mohamed Farah Aideed.

Mr. Oakley had earlier developed a respectful if wary relationship with Aideed, a man he said needed to be treated “as if he were a vial of nitroglycerine that could go off in my hands.”

In an account reported by journalist Mark Bowden, who went on to write the bestselling book “Black Hawk Down,” Mr. Oakley impressed on representatives for Aideed, who was in hiding, that the U.S. president wanted the pilot back unconditionally and fast.

If Durant was not set free, Mr. Oakley warned, the Americans would attack. “The minute the guns start again, all restraint on the U.S. side goes,” he said, according to Bowden’s account. “This whole part of the city will be destroyed, men, women, children, camels, cats, dogs, goats, donkeys, everything. . . . That would really be tragic for all of us, but that’s what will happen.”

Less than a week later, Durant and a previously seized Ni­ger­ian soldier were released as a “goodwill gesture.” Clinton subsequently ordered the liberation of many Somalis being held by U.S. forces, at the request of the Somalis.

The United States soon withdrew entirely from Somalia. Aideed declared himself president in 1995 and was killed the next year by rival forces.

Robert Bigger Oakley was born in Dallas on March 12, 1931, and grew up in Shreveport, La. He graduated in 1952 from Princeton with a degree in philosophy and history.

A stint in Navy intelligence in Japan sparked his interest in foreign affairs and led to his joining the State Department in 1957.

In 1958, he wed the former Phyllis Elliott. Besides his wife, of Washington, survivors include two children, Mary Kress of Falls Church., Va., and Thomas E. Oakley of McLean; and five grandchildren.

His career often interfered with a smooth home life. His work in Vietnam kept him apart from his wife for 22 months. When he was tapped as U.S. ambassador to Pakistan in 1988, he went on a moment’s notice, after his predecessor was killed in a mysterious airplane crash along with Pakistan’s president, Mohammed Zia ul-Haq.

He said that when Powell asked him to go to Somalia in 1992, his wife set down one ground rule: that Mr. Oakley be allowed to return for his son’s wedding later that year. When President Bush was planing a visit to troops in Somalia around the time of the nuptials, Mr. Oakley panicked, thinking he needed to greet the commander in chief.

“My wife called me in Mogadishu and said, ‘Look, President Bush isn’t going there to see you,’ ” he said. “It was a very good point.”