In early March 1977, while recuperating from the gunshot wound he had suffered in the Hanafi Muslim takeover of the District Building, Marion Barry summoned a friend to his hospital bedside to show him the makings of a spectacular rise to power in city government.

Thornell K. Page was startled by what he saw in Barry's room at Washington Hospital Center. There were flower arrangements everywhere, a long list of telephone calls from well-wishers and a fistful of letters of concern from every corner of the city.

What was even more startling was the way Barry, then a D.C. Council member, responded to his brush with death: He was plotting his long-shot campaign for the city's highest elective office.

"He told me to think about setting up an account and a campaign," Page recently recalled. "When I left that meeting at the hospital, I knew Marion Barry was going to be mayor of this city."

The chest wound Barry suffered from a single shotgun pellet turned out to be relatively mild, but the incident was an epiphany for the individual who would soon dominate District politics like no one before him. Barry was the city's Huey Long: a self-styled populist who could outsmart, out-hustle and overwhelm almost any adversary.

The Barry of old was a far cry from the troubled mayor of recent years, whose popularity plummeted and who endured a humiliating drug trial before he finally was rejected by voters last month in a bid for a D.C. Council seat. But for those who knew him well, the early images of a brash, restless and irrepressible politician are the ones that are likely to endure.

He was the self-styled "mobile mayor" who never slept, once alighting on the Mall after an all-night poker game so he could meet Pope John Paul II, according to a friend.

"He was basically a hell-raiser," said Ivanhoe Donaldson, who for many years was Barry's chief political adviser.Formula for an Upset

The son of a Mississippi sharecropper, Barry rose to prominence as a civil rights activist and later as a member of the D.C. school board and the D.C. Council. He upset incumbent Walter E. Washington and Sterling Tucker in the 1978 Democratic mayoral primary, then swept into office in the general election.

He won that primary with crucial support from white liberals, gay people and civil rights activists. Later, he reached out to the black middle class, church leaders and the business community -- constituencies that initially opposed him.

Barry showed unerring judgment in finding ways to expand his political base, many agree. The District's summer jobs program for youngsters, the senior citizens program and the skillful use of appointments to city boards and commissions all paid off politically.

"He was purely a political animal," said Dwight Cropp, Barry's former director of intergovernmental relations. "The majority of programs and policies initiated during the Barry administration were geared to expanding his constituency and reelection.

"With Marion, I could not separate out what he was legitimately interested in for the public good and what he was interested in for his political gain," Cropp said.

Dolly Hardy, a senior citizen activist in Ward 7, sees it differently. "I don't know anybody he ever turned down," she said. "I know he did a lot for a lot of people who needed help. He helped some senior citizens I know go to the clinics, get food, get a place to stay."

D.C. Council member John A. Wilson (D-Ward 2), a frequent critic of the administration whose friendship with Barry dates from the civil rights movement of the 1960s, said Barry "could charm anybody into doing what he wanted if he worked long enough at it."

"Even when we got angry at each other, it wouldn't last more than a couple of days, because we would always finds something amusing to talk about," said Wilson, the council chairman-elect.

One of Barry's greatest political strengths, Wilson and others said, was his obsessive wooing of his political adversaries. The tone was set early in his first term, when Barry reached out to partisans of his vanquished rivals, Washington and Tucker, a former council chairman.

Max N. Berry, a lawyer and Democratic Party activist who served as Barry's chief fund-raiser for many years, recalled a prayer breakfast after the bruising 1978 Democratic primary.

Barry summoned Berry to the head table and quietly asked him to raise money to help cover Tucker's campaign debt.

"I just looked at him," Berry recalled. "I said, 'You're crazy, Mr. Mayor. You've got to be kidding.'

"And he says, 'I'd like you to raise that for him. I'd like to help him out.' "

The money for Tucker was raised before the breakfast ended.

"The mayor defined his true enemies -- people who would never change their minds about him -- very, very narrowly," said Jim Zais, a veteran Barry constituent service worker in Ward 2. "Everyone else he always thought he could win back."

"His politics were the politics of inclusion -- he wanted to include everyone," said E. Ned Sloan, a Shepherd Park neighborhood activist who worked with Barry during the 1960s at Pride Inc., a self-help organization co-founded by Barry. "Every step of the way, he was building his political base . . . . That's why people in the city, despite all his problems, are able to give him some leeway. If they didn't know him personally, they at least know his reputation."Confronting, and Converting, the Enemy

Barry took pleasure in confronting his adversaries on their own turf. In the later years of his administration, when he was virtually persona non grata in some of the city's predominantly white neighborhoods, Barry gamely ventured into community meetings in Northwest Washington to face his critics. Often, he emerged with an element of grudging respect.

Stuart J. Long, a Washington restaurateur who was one of Barry's closest political friends, described a gathering Barry attended several years ago in Spring Valley, where residents were up in arms over the city's land-use policies and reports of government corruption.

"The place was packed," Long said. "He opened up the meeting by saying that he had heard people were taking bets on whether he would show up or not. He said he wanted to make winners out of those people who bet he would show up.

"He just disarmed everybody," Long said.

One adversary Barry has never been able to disarm is council member Betty Ann Kane (D-At Large), who frequently offered scathing assessments of Barry's conduct and public policies.

It wasn't always that way, Kane recalled. She admired Barry during the first two years of his administration, but gradually grew to resent what she described as his high-handedness in budget matters and an increasingly "imperial" bearing.

"The power went to his head," she said. "The imperial aspects got out of hand . . . . It was the misuse of power that turned me" against him.

Barry had a ruthless streak and could be tough on anyone who dared to challenge him or, worse, who embarrassed him politically.

After Jose Gutierrez, then the director of administrative services, publicly suggested there had been improper activity in the awarding of major D.C. contracts, an enraged Barry stripped him of power and soon fired him and ordered an investigation of Gutierrez's own activities.

Barry once described Thomas M. Downs, his city administrator at the time, as "brain dead" after Downs and Police Chief Maurice T. Turner Jr. proposed curtailing a popular police program. In May of this year, he dropped Robert B. Washington's law firm as counsel on a city bond deal after Washington and his partner began supporting D.C. Del. Walter E. Fauntroy's surprise mayoral bid.

"He could be very charming and generous to his friends," Cropp said. "On the other hand, he could be cruel and vindictive."The Continuous Campaigner

For Barry, governing the city was akin to a nonstop political campaign. Accompanied by an ever-present phalanx of security guards, Barry toured the city in a Lincoln Town Car from early morning to midnight, cutting ribbons in Anacostia, meeting with Hispanic activists in Adams-Morgan and touching base with senior citizens in Fort Lincoln.

Inside the car, Barry relentlessly worked the phone, touching base with political allies, bureaucrats, community activists and, it would later be revealed, the girlfriends and nighttime friends who contributed to his downfall.

Barry was chronically late for events, especially news conferences. He also savored making grand entrances in which, strutting and primping to applause, he would manage to upstage lesser political lights.

"He loved being mayor," said Wilson. "He loved the power. He loved the trappings . . . . The thing they said about Marion was he always wanted to be a national figure. He finally got what he was looking for, but not the way he wanted."

The mayor benefited from what some friends describe as an encyclopedic familiarity with Washingtonians and their neighborhoods.

"The Barry magic was based on person-to-person knowledge," said Edward M. Meyers, a longtime Barry aide who now is a member of the D.C. Public Service Commission.

Meyers said he once accompanied Barry, a council member at the time, on a visit to the city-run Lorton Correctional Complex in southern Fairfax County, where inmates lined the fence to greet the future mayor.

"He went down the fence and he knew each person," Meyers said. "He would say, 'Clyde, what are you doing in here? Does your aunt know you are here?' . . . It was incredible. That was the extent to which he knew the city."The Change

Over time, Barry seemed to lose interest in the issues of government and to focus less on decision-making, according to former aides and friends. Some date that to the departure of trusted advisers Ivanhoe Donaldson and Elijah Rogers in 1983; others say Barry, with his unchallenged political dominance of the city, simply grew bored and complacent.

But a far more potent force in his personal decline was Barry's addiction to alcohol and drugs, an all-consuming obsession that was detailed in testimony during his trial last summer.

Aides said they noticed a marked change as Barry drifted into his third term, beginning in 1987. He arrived late for work, stacks of work piled up on his desk and decisions were left hanging. Although he still showed occasional flashes of brilliance, especially during budget talks, he more often appeared sluggish and preoccupied.

One widely shared view is that Barry, out of pride or stubbornness, tried to hang on to office too long.

"There was a charisma he brought to office, a sense of Camelot," said developer Jeffrey N. Cohen, godfather to Barry's son, Christopher. "That faded over time, but that's not just Marion Barry. That's 12 years in office, compounded by his own personal problems."