Fouad Ajami, left, met in 2007 with Iraqi Prime Minister Nouri al-Maliki in Baghdad’s Green Zone. (Wathiq Khuzaie/AP)

Fouad Ajami, a Lebanese-born scholar and commentator who illuminated modern Arab history for audiences in the United States, and who later played a part in that history as an advocate for the invasion of Iraq in 2003, died June 22 at his home in Maine. He was 68.

The cause was cancer, according to an announcement by the Hoover Institution at Stanford University, with which he was most recently associated. From 1980 to 2011, he was director of Middle East studies at Johns Hopkins University’s School of Advanced International Studies in Washington.

Born in a village in southern Lebanon and raised in urban Beirut, Dr. Ajami straddled different worlds from a young age. He settled in the 1960s in the United States, where he pursued a career in academia, became a U.S. citizen and, in an era of extreme division between Western and Arab societies, became a chief, if controversial, interpreter of the Middle East.

His books, articles and frequent television commentaries often had an elegiac quality to them. He lamented dictatorial Arab governments and became widely known for his views on Iraq, where he welcomed intervention by the United States.

As an analyst, he was particularly in demand during the Persian Gulf War of the early 1990s. Little more than a decade later, Dr. Ajami acted as a kind of unofficial adviser to the administration of George W. Bush during the 2003 invasion and subsequent occupation of Iraq.

The Nation magazine, which wrote critically of Dr. Ajami’s involvement, described him at the time as “the most politically influential Arab intellectual of his generation in the United States.”

Dr. Ajami reportedly advised Condoleezza Rice and Paul Wolfowitz, among other leaders in Washington, and met with Gen. David H. Petraeus in Iraq. He also was received in Iraq by prime minister Nouri al-Maliki and Grand Ayatollah Ali Sistani, the powerful Shiite leader.

Dr. Ajami was among those who believed before the war that Iraqis, long oppressed by dictator Saddam Hussein, would receive the United States as their liberator. “We shall be greeted, I think, in Baghdad and Basra with kites and boom boxes,” Dr. Ajami predicted.

As the occupation of Iraq proved more difficult than he had expected, Dr. Ajami maintained a tempered hopefulness. In 2006, he published “The Foreigner’s Gift: The Americans, the Arabs, and the Iraqis in Iraq.”

Reviewing the book in the New York Times, the legal scholar Noah Feldman observed that Dr. Ajami was “respected by politicians who disdain most academics, and excoriated by antiwar academics who detest” the Bush administration — and that he “richly deserves the attention of both camps.”

Dr. Ajami wrote about the fundamental difficulty of taming Iraq.

“A foreign power good at releasing communities from the burden of the past, and from the limits and confines of narrow identity, found itself deep in the thicket of a culture defined by sectarian loyalties,” he explained in the book, looking back at the war. “An innately optimistic America had struck into a land steeped in a history of sorrow.”

Dr. Ajami was born in September 1945 in the town of Arnoun. He recalled an adolescence in which he was exposed to a range of influences. One was Pan-Arabism, a movement for transnational political unity. Another was Hollywood.

“When I was coming of age,” he once told Forbes, “my one great passion — and that of other boys like me — was Hollywood Westerns. Ours was still a quaint city, and Lebanon a small, hemmed-in country. The Western, with its great outdoors, its drifters, its sassy women and gunslingers, held me in thrall. It was from Audie Murphy and Gary Cooper and Jane Russell and Susan Hayward that I conceived my attachment and my romance for America.”

Dr. Ajami received a bachelor’s degree from what is now Eastern Oregon University before receiving a master’s degree in 1969 and a PhD in 1973, both in political science, from the University of Washington. He was associated with Princeton before joining SAIS.

His books included “The Arab Predicament: Arab Political Thought and Practice Since 1967” (1981), “The Vanished Imam: Musa al Sadr and the Shia of Lebanon” (1986), “The Dream Palace of the Arabs: A Generation’s Odyssey” (1998) and, most recently, “The Syrian Rebellion” (2012) and “Crosswinds: The Way of Saudi Arabia” (2013).

In 1988, he and photographer Eli Reed collaborated on the book “Beirut: City of Regrets.”

Dr. Ajami, wrote The Washington Post columnist David Ignatius, had composed “an elegy for the Beirut of his memory, a charming, seductive but ultimately impossible city that is now as dead as ancient Phoenicia.”

Dr. Ajami’s honors included the prestigious MacArthur fellowship and, in 2006, the National Humanities Medal. A complete list of survivors could not immediately be confirmed.

Shortly before he died, Dr. Ajami wrote in a Wall Street Journal column that the current “sad state of affairs” in Iraq “was in no way preordained.”

“Someone asked me for my ultimate summation of the war,” he had said in a 2007 appearance on CNN. “Occasionally, we will come to a point where we might say, look, this was a noble war.”

The question, he added, was “is it a noble success or a noble failure?”