On the eve of Israeli Prime Minister Shimon Peres' visit to Washington in October 1985, a close friend of Attorney General Edwin Meese III hurried into the offices of the Overseas Private Investment Corp. with a new idea for the $1 billion Iraqi pipeline project he had been promoting.

The promoter, San Francisco lawyer E. Bob Wallach, had nothing in writing, but essentially he proposed that U.S. foreign aid funds be used to insure the pipeline against destruction by Israel. And, sources say, he was insistent that the request for a legal ruling on the proposal be directed to Meese himself.

"We said that that would really not be appropriate," recalled one OPIC official, pointing out that such requests were traditionally addressed to the Justice Department's Office of Legal Counsel. But Wallach was emphatic, reportedly telling the OPIC officials: "I prefer you send it to the attorney general. It'll get delegated."

The request was promptly sent to Meese, and it was delegated just as promptly to a newly appointed Justice Department official whom Wallach had helped to hire and whom, sources say, Wallach had already urged to produce a favorable ruling.

The maneuvering over the pipeline, which also involves Israel, the National Security Council and the Central Intelligence Agency, is the focus of intense investigation by special prosecutors who for the past nine months have been scrutinizing Meese's conduct. The White House has been warned by independent counsel James C. McKay of the gravity of the inquiry.

The twists and turns of the pipeline project bear startling parallels to the Reagan administration's secret arms dealings with Iran. They also suggest how easy it can be for private entrepreneurs to get the support of U.S. officials by waving the banner of national security over questionable transactions.

The pipeline project itself struck many in Washington as a genuinely worthwhile undertaking before Wallach and his wealthy client, Swiss businessman Bruce Rappaport, got involved in it in 1985. Iran had destroyed Iraq's oil terminals in the Persian Gulf early in the Iran-Iraq war. The proposed 540-mile pipeline, running from Iraq's Kirkuk oil fields to the Jordanian port of Aqaba near the Red Sea, would have more than doubled that nation's oil exports. It also would have been a "trade bonanza" for the United States and the companies seeking to build it.

"It would have brought in a billion dollars plus at a time when it was increasingly difficult to get projects overseas for major contracts," said one government official familiar with the plan. "It was a project that had genuine merit, quite apart from any foreign policy consideration. Certainly it would have been very helpful to the economy of Jordan, which is a very poor country."

By mid-1984, Bechtel Group Inc., a giant engineering company with headquarters in San Francisco, had tentatively scheduled work to start that fall. The project, to be completed in two years, was regarded as important enough to U.S. national security interests for American officials to have given Iraq oral assurances, apparently received from the Israeli government, that Israel would not attack the pipeline. A preliminary decision by the U.S. Export-Import bank to guarantee $485 million in American bank loans for the pipeline, 85 percent of the total projected U.S. investment, had raised hopes that construction would soon begin.

Iraqi President Saddam Hussein, however, in a July 16, 1984, speech marking the 16th anniversary of his Baath Party rule, indicated that his country wanted a firmer guarantee for the pipeline, which was to run dangerously close to Israeli territory.

Officials at Bechtel saw that insurance was needed to make sure the interest payments would be met, especially during the vulnerable construction period. In early 1985, the company entered into discussions with Rappaport and a Rappaport firm, National Petroleum Ltd. Bechtel officials have said Rappaport was recommended to them by "overseas business associates" for his experience in security bonding and, others say, for his close ties to prominent Israeli political figures, including then-Prime Minister Peres. Rappaport, a native-born Israeli multimillionaire now living in Geneva, said yesterday in an interview that he had known Peres for 45 years.

Rappaport evidently was also a good friend of William J. Casey, the late CIA director. At one point during the negotiations over the pipeline, Casey turned up as Rappaport's guest of honor at a party in a banquet room of the Fourways Washington Restaurant here.

By late spring of 1985, Wallach, a San Francisco lawyer who had moved to Washington to be in closer touch with Meese, had been retained by Rappaport and used his ties with Meese to gain entree to the National Security Council. Sources familiar with the pipeline proposal say Wallach apparently was brought in because of his long friendship with Meese, just as Rappaport had been brought in by Bechtel for his influence in Israel.

An acquaintance of Meese since law school days in California in the late 1950s, Wallach used to meet with him every Friday at the White House when Meese was presidential counselor. And, after Reagan's election in 1980, Wallach said in an interview last year, he gradually became a kind of emissary between Jewish groups and the administration.

According to informed sources, Wallach arranged a get-together with then-national security adviser Robert C. McFarlane at the White House during the summer of 1985 after a phone call by Meese paved the way. Rappaport also attended, one source said. McFarlane, sources said, reaffirmed the importance of the pipeline to national security and assigned the project to a staff aide.

Officials at OPIC, a small government agency that insures foreign investments by U.S. firms, say they were asked by Rappaport and his lawyers around the same time to help set up an insurance fund that would protect the pipeline up to the day oil started flowing through it and it could begin paying for itself. This would have required a maximum insurance of $400 million, it was estimated -- too much for OPIC to handle by itself.

Another difficulty, officials say, was that there was no investment agreement between the United States and Iraq, usually a prerequisite for OPIC involvement. But, as one official put it, "we kept hearing from Rappaport that this was a matter of the highest national security."

In late June, an NSC aide informally sounded out OPIC officials about the project. They decided that if they were to be expected to do "something unusual," they ought to hear it at a formal NSC staff meeting.

McFarlane presided over the meeting on June 27 and told them directly that the project was in the national interest. One of the ideas behind this theme, sources say, is that Iraq, as a potential enemy of Israel, would be disinclined to go to war with Israel after spending $1 billion on a pipeline the Israelis could easily blow up.

OPIC officials, one source said, told McFarlane they "would do their best, but they couldn't promise anything. He {McFarlane} accepted that."

The next month, Wallach went to London and negotiated a one-year agreement between Rappaport and Bechtel that was signed July 16. Under it, Bechtel officials say, Rappaport and Rappaport's firm, National Petroleum Ltd., were to handle the sale of oil through the pipeline and "arrange for the security or the insurance or whatever it would take."

"He {Rappaport} stood to make a heck of a lot of money," said one former official familiar with the project. "There was going to be 300,000 barrels a day coming out of the pipeline and the wellhead price was something in the neighborhood of $3 to $4 a barrel."

Rappaport was in Washington again that summer to preside over the dinner for Casey. Invited guests included officials assigned to the pipeline project. "The purpose was to show he {Rappaport} was well-connected," said one person who attended. "And he knew Casey. It was clear they were acquainted and had been for some time." Wallach was also at the party, which about 15 to 20 attended.

At some point that year, Wallach also wrote a memo to Meese about the project, reportedly recounting a plan to make payments to Peres' Labor Party or a high-ranking Israeli official, perhaps Peres, in order to help keep the pipeline safe from Israeli attacks. It is this memo and Meese's inaction on it that is the focus of McKay's investigation. Sources say the document came out of Meese's own files.

"It's really amazing," said one government official who had been involved with the project. "If you're going to do things like this, you ought to be good at it. To have written these memos and then for the recipient to keep them is really amazing."

Meese defenders, in turn, suggest the attorney general has been unfairly tarred by a memo whose contents remain closely guarded.

Rappaport told Israel Radio yesterday that he never offered or paid bribes to Peres or any other official or political party in Israel to win support for the project. Similarly, Peres, responding to questions through an aide over the weekend, said he had never discussed "financial matters" with Rappaport or Wallach and that no money or anything of value had been offered to or accepted by him or the Labor Party.

What is undisputed, in any event, is Wallach's penchant for name-dropping. He claimed to U.S. officials that he had talked to Peres twice about the project. Through McFarlane, he also tried to enlist former national security adviser William P. Clark to give what McFarlane called "a White House dimension" to the project at a proposed meeting in Baghdad in August 1985.

Sources say Clark agreed to take a look at the proposal but decided not to participate after learning that Wallach had been dropping his name prematurely in various memos to Rappaport and to Bechtel. Another negative factor, sources said, was a CIA report on Rappaport that said he had had business problems and depicted him as a controversial figure.

OPIC officials had heard from one of the financial institutions working on the project that it had serious questions about dealing with Rappaport, so they asked the CIA "basically for everything they had on Rappaport," sources say. But all the OPIC officials got was a skimpy CIA summary of newspaper clippings that raised no warning signals.

The negative CIA report was never shown to OPIC officials and apparently not to McFarlane either, sources say. The NSC adviser and President Reagan evidently continued to support the project.

By the fall of 1985, however, officials at OPIC were disenchanted. They had worked for months to put together what some still say was a workable proposal, involving genuine commitments such as letters of credit from Rappaport, the government of Israel and other parties who stood to benefit.

"What Iraq wanted was insurance that would protect it in event of destruction of the pipeline," one expert said. "In a pipeline financing, the cost escalates during the construction period. Essentially, $400 million was what was needed {for insurance} -- that was the interest Iraq would have owed the day before the line was turned on . . . . What they {the Iraqis} were looking for was protection during the period of exposure."

This was too big a bill for OPIC, so officials there drafted a plan that would spread the risk and raise some $100 million in guarantees from other "major players." Israel was to put up a third of that and Rappaport was to come up with a percentage. Sources say one of Rappaport's lawyers initialed the proposal at one point, but Rappaport disavowed it.

"Rappaport walked away from it. He said he was not bound by it," one source said. Israel did not go along either. As a result, OPIC officials were somewhat sour on the project by mid-October when Wallach walked in the door again and proposed using U.S. foreign aid funds. The proposition was that if Israel destroyed or attacked the pipeline, foreign aid funds that Congress had voted for Israel would be turned over to OPIC for payment for Iraq.

The proposal was full of "smoke" combined with a lot of pressure, one source said. Another source pointed out that when Congress votes foreign aid to one country, the intention is that it go to that country and not another. There was also some skepticism that Israel would be willing to turn the money over in the presumably warlike atmosphere that would have accompanied an attack on the pipeline.

Wallach, however, was reportedly enthusiastic, alluding to Prime Minister Peres' imminent visit and saying, "we've got to get things moving again." When OPIC officials recited their objections, he asked what it would take to satisfy them. Sources say OPIC's then-general counsel, Robert B. Shanks, replied that the only agency that could issue a legal opinion binding on other agencies was the Justice Department's Office of Legal Counsel.

"Wallach," one source recalled, "said, 'well, that's fine. I think we can get that.' "

OPIC officials said they would request a ruling from Ralph Tarr, then head of the Office of Legal Counsel (OLC), a traditionally independent unit, but Wallach pressed them to send the request to Meese. The request for a ruling was accordingly sent to the attorney general on Oct. 17, 1985, the same day that Peres was in town on a state visit. Wallach asserted that he met Peres sometime during this visit.

When the OPIC request for a ruling got to Meese's office, it was assigned to Allan Gerson, technically a deputy assistant attorney general under Tarr in the Office of Legal Counsel but also a "special assistant" who reported directly to Meese on national security affairs. Wallach, in his role as unofficial adviser to Meese, had interviewed Gerson for the job and, sources say, pressed him for a favorable ruling on the pipeline scheme. Wallach, sources say, also said fast action was urgent.

Gerson produced an "Eyes Only" memo for Meese on Oct. 21, 1985, advising against the proposal as outlined by OPIC but suggesting an alternative approach. "Given the urgency of the matter," he told Meese, "I thought you might wish to have the benefit of my initial observations and preliminary conclusions."

Tarr, who got a copy of the OPIC request through other channels, had another lawyer in his office do an internal memo warning that the proposal posed a lot of hurdles and that talks with the State Department would be needed since foreign aid money was involved.

They were never held. A month or so later, the Iraqi ambassador told interested parties at a lunch at Le Pavillon that he recognized there were difficulties because of others "who were not putting up what they agreed to put up."

But that was not quite the end of the project. When Rear Adm. John M. Poindexter succeeded McFarlane as national security adviser in December, he found the pipeline project still alive, sources say, and he consulted Clark about it. McFarlane had never informed Poindexter about the project, according to former government officials.

Reportedly alarmed at the shape it had taken since he had walked away from it, Clark is said to have assailed it as "a protection scheme . . . a nightmare." He reportedly told Poindexter and his aides that it should be terminated immediately and it finally was.

Washington Post staff writer Lou Cannon contributed to this report.