The congressional committees on the Iran-contra affair voted yesterday to compel Marine Lt. Col. Oliver L. North to testify under a grant of limited immunity from prosecution about his role in that affair, but agreed to postpone his public testimony until at least mid-July to give the criminal prosecutor more time to develop his case.

Independent counsel Lawrence E. Walsh, who Tuesday asked the committees not to give North immunity or to delay it, said: "The precautions they have taken to prevent premature and perhaps unnecessary exposure of Col. North's testimony will reduce as much as is reasonably possible any adverse effect on our investigation."

Walsh was concerned because any criminal charges he might bring against the fired National Security Council aide must be based on evidence other than North's congressional testimony. North was named a coconspirator along with two conservative fund-raisers who pleaded guilty to charges of defrauding the government by using tax-deductible contributions to buy weapons for the Nicaraguan contras.

Sen. Daniel K. Inouye (D-Hawaii), chairman of the Senate select committee on the Iran-contra affair, said North's testimony is essential because recent testimony has "cast a cloud over the presidency."

The committees had wanted to grant immunity to North and Rear Admiral John M. Poindexter, a former national security adviser, earlier, but delayed action after an agreement with Walsh. Under that agreement, they granted Poindexter immunity and began taking his testimony privately last month. He is not likely to appear publicly until early next month.

North could be questioned in private beginning June 15 and could be summoned to testify in public as early as July 16, committee officials said. They left open, however, the question of whether North, who directed a private effort to aid the contras, will appear at the public hearings.

When North was summoned before Congress previously, he refused to answer questions on grounds that he might incriminate himself.

Rep. Lee H. Hamilton (D-Ind.), chairman of the House panel, said new votes would have to be taken to decide whether North would be put on the stand at the public hearings.

Since the committees had earlier agreed to delay public testimony by North until June 23, yesterday's action means Walsh will have at least three more weeks to gather evidence before North appears.

Sources said that Walsh has no plans to seek indictment of North before his public testimony. Walsh would prefer to wait at least until he can gain access to Swiss bank accounts used in the Iran-contra affair, which so far has been blocked by legal challenges.

Other sources said yesterday that FBI agents working for Walsh are looking through the NSC's most sensitive files for additional information on the Iran-contra affair.

There have been suggestions in recent congressional testimony that North may have profited from his Iran-contra affair.

Albert A. Hakim, chief financial adviser to the private network North ran, testified that he set aside $200,000 as a "death benefit" for North last year and had a colleague discuss a plan with North's wife, Betsy, to funnel money to the family for the children's education.

Contra leader Adolfo Calero testified two weeks ago that he gave North $90,000 in blank traveler's checks in 1985. Investigators found that North cashed checks worth $2,400 himself. He used some of the money to buy gasoline, groceries and snow tires and gave $1,000 to a liaison with the contras for a wedding gift.

Last spring, a former CIA employe paid for a $2,000 electronic security gate at North's home after learning from retired Air Force major general Richard V. Secord, Hakim's business partner and North's key aide in the private Iran-contra network, that North was being threatened.

North has told friends he has received threats because of his role as the NSC's counterterrorism expert.

North lives in a large, red brick house on a two-acre lot near Great Falls assessed at $164,485. He bought the house in 1983 for $136,000. His monthly mortgage payment is $1,256, according to public records.

He supports his wife and four children on an annual income of $50,000. His Marine Corps salary as a 19-year veteran is $42,177. A colonel of his experience also gets $8,383 in nontaxable subsistence and housing allowances, a Marine spokesman said.

Any suggestion that North may have profited from secret government work is rejected by friends. F. Andrew Messing Jr., a conservative activist who has helped raise money for North's legal defense, said he doesn't think Hakim's actions were meant "to engender any personal gain for North." He added that the truth won't be known until "we hear his side of the story."

Messing, who said he talked to Betsy North on Wednesday, called her a "very charming, gentle and thoughtful woman. Ollie describes her as his best friend." He said she isn't employed and, citing security concerns, declined to discuss their children, three girls and boy.

Other friends of North say they have raised nearly $90,000 for his legal defense fund.Staff writers Patricia Davis and Anne Koch contributed to this report.