For nearly five decades, America's role in the military coup that ousted Iran's elected prime minister and returned the shah to power has been lost to history, the subject of fierce debate in Iran and stony silence in the United States. One by one, participants have retired or died without revealing key details, and the Central Intelligence Agency said a number of records of the operation -- its first successful overthrow of a foreign government -- had been destroyed.

But a copy of the agency's secret history of the 1953 coup has surfaced, revealing the inner workings of a plot that set the stage for the Islamic revolution in 1979, and for a generation of anti-American hatred in one of the Middle East's most powerful countries.

The document, which remains classified, discloses the pivotal role British intelligence officials played in initiating and planning the coup, and it shows that Washington and London shared an interest in maintaining the West's control over Iranian oil.

The secret history, written by the C.I.A.'s chief coup planner and obtained by The New York Times, says the operation's success was mostly a matter of chance. The document shows that the agency had almost complete contempt for the man it was empowering, Shah Mohammed Reza Pahlevi, whom it derided as a vacillating coward. And it recounts, for the first time, the agency's tortured efforts to seduce and cajole the shah into taking part in his own coup.