When Monica Lewinsky signed an immunity deal on Tuesday that freed her from legal peril and transformed the legal and political dynamics of the independent counsel Kenneth Starr's four-year investigation of President Clinton, Clinton and his presidency were confronted with a morass that he will be forced to face in grand jury testimony in two weeks.

Lewinsky, who turned 25 on July 23, meanwhile moved closer to a cherished goal. "For my birthday," Lewinsky had told her family, "I want my life back."The story of Lewinsky's journey from target to cooperating witness was culled from more than a dozen interviews with lawyers involved in the investigation, as well as with associates and friends of the former White House intern.

The Starr-Lewinsky alliance that seemed unlikely as recently as last month was put together by a cast of lawyers. But two of the most important players were seasoned criminal defense lawyers Jacob Stein, 73, and Plato Cacheris, 69, who have only represented Lewinsky since June 2. The two Washington insiders broke a six-month deadlock of bad blood and broken promises between Starr's prosecutors and Lewinsky's first lawyer, William Ginsburg.

Shortly after Stein and Cacheris were retained by Lewinsky, they visited Starr, whom both men knew through Washington legal circles.

"I have one good trial left in me," Stein told him, "and I'm going to put it at Monica's disposal."

That sent a clear message: Lewinsky was prepared to fight an indictment. And Starr was well aware that Stein had won the only acquittal in a major criminal trial in the Watergate case.

For Starr, Stein's remark also increased the pressure to work out a deal with Lewinsky: If Lewinsky were indicted, a trial would likely delay his final report for a year or longer.

Despite the legal coup, Stein and Cacheris are somber, perhaps because they are veterans of the Watergate crisis.

"There was nothing to celebrate," Stein said in an interview in his book-lined law office here, facing an etching of Shakespeare. "None of this called for a party. This is a tragedy."