It struck some visitors to the Houston office of ConocoPhillips chief executive Jim Mulva as peculiar that he displayed a photograph of himself and Libyan leader Moammar Gaddafi.

They were an odd couple: a veteran of corporate politics at a U.S. oil company and the colonel who had survived four decades of confrontation with the West while maintaining repressive rule over his North African nation.

But the relationship between Gaddafi and the U.S. oil industry as a whole was odd. In 2004, President George W. Bush unexpectedly lifted economic sanctions on Libya in return for its renunciation of nuclear weapons and terrorism. There was a burst of optimism among American oil executives eager to return to the Libyan oil fields they had been forced to abandon two decades earlier. Gaddafi, who had been sanctioned for Libya’s role in the downing of Pan Am Flight 103 over Lockerbie, Scotland, also looked forward to U.S. help in reviving his flagging oil production.

Yet even before armed conflict drove the U.S. companies out of Libya this year, their relations with Gaddafi had soured. The Libyan leader demanded tough contract terms. He sought big bonus payments up front. Moreover, upset that he was not getting more U.S. government respect and recognition for his earlier concessions, he pressured the oil companies to influence U.S. policies.

In late February 2008, Mulva was “summoned to Sirte for a half-hour ‘browbeating’ ” from Gaddafi, according to a U.S. State Department cable made available by WikiLeaks. Gaddafi “threatened to dramatically reduce Libya’s oil production and/or expel . . . U.S. oil and gas companies,” the cable said.

Now, this troubled marriage and the promise of billions of barrels of oil have been dashed by the fighting and Gaddafi’s refusal to relinquish power. Much is at stake; oil industry executives say companies such as ConocoPhillips and Marathon have each invested about $700 million over the past six years. But the U.S. oil companies have been pushed to the sidelines, waiting for the conflict to end.

In 2004, oil giants and Libya had hopes for a new relationship — and new discoveries.

U.S. companies had historically played a major role in Libya’s oil development. The Oasis Group — a consortium of ConocoPhillips, Marathon Oil and Hess — and Occidental Petroleum were particularly prominent. Exxon, Chevron and Italy’s state-run Eni were also major players.

They had weathered the 1969 coup when Gaddafi seized power. In 1970, when Gaddafi had threatened to nationalize oil operations, Occidental Chairman Armand Hammer flew to Tripoli for face-to-face negotiations. Each night, he flew back to Paris, where he felt safer. At one meeting, the deputy prime minister put his .45 revolver down on the table. The result: Libya extracted higher prices and a boost in royalties.

That was the beginning of a decade that tilted the balance of power away from oil companies toward oil-exporting countries. Yet it was U.S. government policy in 1986 that finally severed the companies’ relations after Libyan agents, in retaliation for a U.S. bombing raid on Tripoli that President Ronald Reagan ordered, set bombs that brought down the Pan Am flight, killing 270 people.

2004 deal with U.S.

When Gaddafi made his deal with Bush in 2004, he had hoped that returning foreign oil companies would help boost Libya’s output, which had dipped below 2 million barrels a day after reaching 3 million in the early 1970s.

Moreover, he saw foreign-policy benefits. “Gaddafi has always felt that he was not safe from the United States and that if he has more business, more trade, then things would change,” said Ali S. Aujali, a former Libyan ambassador to the United States.

The U.S. government also encouraged American oil companies to go back to Libya. “Back when the sanctions were first lifted,” said David Goldwyn, until recently head of international energy affairs at the State Department, “there was from the Bush administration’s point of view this promise of economic activity in return for renouncing weapons of mass destruction and terrorism.”

The companies needed little encouragement. Libya has some of the biggest and most proven oil reserves — 43.6 billion barrels — outside Saudi Arabia, and some of the best drilling prospects. Its older fields, which suffered during U.S. sanctions, could benefit from enhanced recovery techniques and be the source of vast new production.

“Oil companies were extremely excited to move into a territory that had been neglected for 20 years,” said Geoff D. Porter, a political risk and security consultant specializing in North Africa and the Sahara. He said experts believed that only 30 percent of Libya had been explored and that there was “much more oil to be discovered.”

But negotiations were tough, and some companies paid lavishly for the chance to get back in.

A State Department cable in December 2004 said, “Conoco characterized the agreement as ‘not good,’ but said the company views it as ‘dues-paying’ in order to return to the Libyan market.”

In 2005, the Oasis Group returned to the same fields it had operated 19 years earlier, but only after agreeing to pay $1.3 billion for reentry and a 25-year extension of its concessions over 13 million acres in Libya’s Sirte Basin.

Occidental also rushed back. When Libya put 15 new exploration blocks up for bid, U.S. companies got 11 of them, nine going to Occidental.

Throughout this time, oil prices kept rising, whetting the appetite for greater supplies of Libya’s unusually “sweet” and “light,” or high-quality, crude oil.

By the time Secretary of State Condoleezza Rice visited in 2008, U.S. joint ventures accounted for 510,000 of Libya’s 1.7 million barrels a day of production, a State Department cable said.

‘Resource nationalism’

But all was not well. By November 2007, a State Department cable noted “growing evidence of Libyan resource nationalism.” It noted that in his 2006 speech marking the founding of his regime, Gaddafi said: “Oil companies are controlled by foreigners who have made millions from them. Now, Libyans must take their place to profit from this money.” His son made similar remarks in 2007.

Oil companies had been forced to give their local subsidiaries Libyan names, the cable said. Eni, for example, became Mellita, and the Spanish firm Repsol became Akakoss. Labor laws were amended to “Libyanize” the economy, and oil firms were pressed to hire Libyan managers, finance people and human resources directors.

“Those who dominate Libya’s political and economic leadership are pursuing increasingly nationalistic policies in the energy sector that could jeopardize efficient exploitation of Libya’s extensive oil and gas reserves,” the cable concluded.

Then in early 2008, Sen. Frank R. Lautenberg (D-N.J.) tacked an amendment onto a defense appropriations bill that made it easier for families of the victims of the Lockerbie bombing to go after Libya’s commercial assets.

The Libyan leader was livid, evident in his scolding of Mulva. The equivalent of the deputy foreign minister told U.S. officials that the Lautenberg amendment was “destroying everything the two sides have built since 2003,” according to a State Department cable at the time.

The U.S.-educated Libyan oil minister Shokri Ghanem — who recently left Libya and defected from the Gaddafi regime — in 2008 warned an Exxon Mobil executive that Libya might “significantly curtail” its oil production to “penalize the U.S.,” according to a State Department cable. By the time Rice visited, however, Libya had negotiated a resolution to the families’ claims.

But doing business in Libya remained difficult. “Everything in Libya — everything — had to be approved by Gaddafi or one of his sons,” said Nansen Saleri, the founder of Houston-based Quantum Reservoir Impact and former head of reservoir management at Saudi Aramco. “. . . That’s one reason we elected not to be involved.”

Saleri said that he would like to do business enhancing the percentage of oil recovered from known reservoirs but that he would wait for the political situation to settle down.

“Just the infusion of new capabilities through Western service companies will stabilize production and increase it,” he said. “They have the reserves.”

But Libya’s oil production has foundered, sagging to about 1.5 million barrels a day by early this year before unrest broke out. The big oil companies, several of which had drilled dry holes, felt that Libya was not making the best exploration prospects available. One major company privately said that it was on the verge of a discovery but that unrest cut short the project.

With the country torn by fighting, the big international oil companies are treading carefully, unwilling to throw their lot behind Gaddafi or the rebel coalition.

Yet when representatives of the rebel coalition in Benghazi spoke to the U.S.-Libya Business Council in Washington four weeks ago, representatives from ConocoPhillips and other oil firms attended, according to Richard Mintz, a public relations expert at the Harbour Group, which represents the Benghazi coalition. In another meeting in Washington, Ali Tarhouni, the lead economic policymaker in Benghazi, said oil contracts would be honored, Mintz said.

“Now you can figure out who’s going to win, and the name is not Gaddafi,” Saleri said. “Certain things about the mosaic are taking shape. The Western companies are positioning themselves.”

“Five years from now,” he added, “Libyan production is going to be higher than right now and investments are going to come in.”