The chain of events that led D.C. Mayor Marion Barry last week to an isolated studio on the campus of Howard University to record an emotional announcement began well before his arrest in January in an FBI drug sting.

Although the arrest at the Vista Hotel was pivotal, other factors -- including the federal government's subsequent broadening of its drug charges against him, the weakening of his political base and the mounting stresses of running a big-city government -- also contributed to his decision not to seek another term, according to close friends and associates.

Months before FBI agents videotaped him allegedly using crack cocaine at the Vista, a fatigued and obviously troubled Barry indicated he wasn't sure he wanted to run for an unprecedented fourth term, they said.

"The issue to run plagued him even last fall. Would he do it? Could he do it?" said Ivanhoe Donaldson, a former deputy mayor and political adviser to the mayor. "There was a little doubt in the back of his mind to start with, and these serious life crises put the issue squarely on the table."

Another adviser said that while Barry's public indications were always that he intended to run, "He had obvious doubts as far back as last spring.

"He never really put together a formal campaign organization. He never had an active campaign strategy in the fall," the source said. "There was some ambiguity about what he was going to do, both among his supporters and with Marion himself."

Barry, who dominated D.C. politics for more than a decade, vacillated for months before deciding two weeks ago to take himself out of the race, according to sources. Yet even then, there was an air of uncertainty among his supporters until his recorded announcement was broadcast Wednesday evening.

To some degree, Barry's vacillation reflected divisions within his camp. Anita Bonds, Barry's campaign manager and chief political adviser, urged the mayor to hold on. She arranged several campaign-style appearances across the city designed to demonstrate that the mayor retained considerable support.

Others, including Jesse L. Jackson, urged the mayor to cut his losses and get out of the mayor's race in hopes that the gesture might pave the way for a plea agreement with U.S. Attorney Jay B. Stephens. Some sources said Donaldson was among those urging Barry to abandon his reelection hopes, although Donaldson would not comment on that.

Barry was stung by some of his closest friends and advisers -- including campaign chairman Robert L. Johnson -- who defected to the mayoral campaign of Del. Walter E. Fauntroy (D-D.C.), which was launched in March while Barry was undergoing substance abuse treatment in Florida.

For a while after he returned to Washington, it appeared that Barry had regained control of city politics. During a series of appearances, he apologized for his problems, physically and symbolically embraced many important players in Washington and adroitly kept Fauntroy and other challengers off balance.

"Barry's back," he proclaimed on more than one occasion.

"He had new energy, he had euphoria," said one longtime adviser. "He thought he was going for it."

As recently as early May, Barry told associates that he still had political options, including the possibility of running as an independent in the general election if he missed the July 5 filing deadline to run in the Sept. 11 Democratic primary. One adviser says Barry was quite upbeat about that opportunity.

But the turning point came May 10, when the federal grand jury that had indicted Barry on charges of cocaine possession and perjury issued a superseding indictment, charging that Barry had used drugs on numerous occasions dating to 1984.

The new charges went well beyond the previous allegations that Barry had used drugs at the Vista and at the Ramada Inn a year before and underscored for Barry the extent of his legal peril, friends said. Donaldson said it was as if Barry had been hit with a "sledgehammer."

"It didn't make his life any easier, that's for sure," Donaldson said. "It didn't make his legal case any easier. It didn't make his political role any easier."

Another problem weighing on Barry was the city's mounting fiscal crisis. Robert Pohlman, the deputy mayor for finance, and others told Barry that the city faced a potential $90 million budget deficit and the possibility of a missed payroll this summer, according to sources.

For years, Barry had complained privately about the stress of office and the relentless scrutiny of the media. Pohlman's warnings only heightened his feeling that it made little sense to fight for another term. As one source said, Barry had no stomach for "four more years of hell."

From the start, Barry had been adamant that he would not resign or plead guilty to a felony, but he and his legal advisers dangled the possibility he would not run again as a bargaining chip in dealing with prosecutors. With time running out before a jury was impaneled, Jackson met with Barry, then made public statements June 6 urging Barry to announce he would not run again to encourage Stephens to come to the bargaining table.

When it became obvious Stephens would not be influenced by Barry's taking himself out of the race, the mayor and his lawyers switched tactics and tailored the announcement to prospective jurors in the case. They hoped that by making the announcement before the trial began, they could convince some jurors that Barry was a defeated politician and an unworthy target for the full force of the law.

In drafting his speech, Barry emphasized that his decision not to run "is not related to my legal situation," but rather to his efforts to recover from alcohol and chemical dependence and to end the suffering of his wife, Effi, and son, Christopher.

With a trial all but inevitable, a new sense of realism began to set in.

"Trying to run a campaign and preparing for trial -- it just got to be too much," said one senior administration official.

By the time he gathered some of his oldest friends and supporters last Sunday night at the upper Northwest home of campaign treasurer Charlotte Chapman, it was clear that Barry's roller-coaster ride had ended: He had decided to get out of the race for good.

Among those who gathered were Bonds and her aide, Alice Harper; senior housing official Ben Johnson; and longtime friends and political supporters Patricia Mathis, Marshall Brown, Thornell Page, Jeffrey N. Gildenhorn, Ruth Long, Jeffrey Cohen and Stuart Long.

Barry told the group that, after two weeks of trying, he finally had persuaded Bonds that announcing his decision not to run "was the right thing to do," sources said.

There was some discussion about when and where to make the announcement. One major, if largely unspoken, theme of the meeting was how to reach "that one juror" who might be persudaded that Barry had suffered enough and would not vote to convict, several sources said.

It was suggested that Barry hold a news conference at the District Building, but the mayor rejected that proposal, saying he didn't want to be hounded by the media.

"He was resolute," said one participant at the meeting. "There was some sadness. There was some relief. It was kind of a reminiscing occasion . . . . There was a lot of pride about what had been accomplished."

As jury selection continued in his case Wednesday morning, Barry sat at the defense table, apparently marking a copy of his speech. He could be seen mouthing the words while paying little attention to the court proceedings. During the lunch-hour recess, the mayor was driven to the studios of WHMM-TV (Channel 32) at Howard University.

After months of deliberation and maneuvering and surrounded by his most ardent supporters, the mayor was about to make his long-awaited announcement in the relative isolation of a small university television studio.

Barry entered the television studio, was lightly powdered by a makeup artist and waited while technicians performed a lighting check. Then Barry was alone, surrounded by three bright lights, a television camera, a lectern with microphone and a backdrop in "chromakey" blue.

It took him 13 minutes to deliver his powerful and at times emotional speech, and afterward he watched the tape that would appear that evening before thanking the production staff and returning to court.

In his speech, Barry quoted Ecclesiastes. "For everything there is a season, and a time to purpose under the heavens; a time to lose, a time to keep and a time to cast away."

"Tonight, it's time to cast away."

Staff writer Nathan McCall contributed to this report.