A nostalgic Marion Barry bade farewell yesterday to the office of D.C. mayor, saying he had "fought the good fight" during his 12 years in office to help the disadvantaged of Washington and empower those long shut out of city politics.

Barry, appearing before a group of senior government officials and supporters less than three weeks before the mayoral inauguration of Democrat Sharon Pratt Dixon, said he hoped his struggle with drug addiction will help others facing similar problems and pledged to "spend a lot of time working to help people come into and stay in recovery."

The mayor, who has appealed the six-month prison sentence he received after his conviction this summer on a misdemeanor charge of cocaine possession, also called on District residents to band together against street violence, which he described as the "most crucial matter for us to address."

"The apathy must end," Barry said. "We must reinstill those age-old values that teach us the sanctity of life."

Barry made no mention in his 35-minute address of the remarkable chain of events this year that began with his Jan. 18 arrest in an FBI sting operation at the Vista Hotel and ended with his defeat last month in a race for an at-large seat on the D.C. Council.

Instead, the speech at the Frank D. Reeves Municipal Center in the old riot corridor at 14th and U streets NW was an occasion for reflection, a time for summing up a career that in nearly 30 years took the onetime street activist to the pinnacle of power in District affairs.

Barry was by turns jovial and serious, speaking with evident pride about the accomplishments of his three terms. Effi Barry, the mayor's estranged wife, sat behind him on a dais in the Reeves building lobby, and appeared to brush a tear from her eye at the end of his speech.

As he often did this year, Barry took as his theme a Biblical passage, quoting a message of perseverance from the apostle Paul to Timothy: "I have fought the good fight. I have run the great race. I have finished the course. I have kept the faith."

"I have never retreated from my dreams," Barry said a few moments later. "At every step -- from the civil and human rights movement, to Pride Inc., to the presidency of the school board, to the city council, to the office of mayor -- I carried with me that shared zeal and dedication to make a profound difference.

"Because of the innovations and the work that has been done, Mayor Dixon and her new team will find a city fundamentally strong, tough enough to endure our current problems," said Barry, who departed from his text to add: "No matter how hard they try, they can't take it away from us."

Barry, observing at one point that government should be gauged "by what it does for the least among us," said one legacy of his administration was to have "opened the doors of government to those who had not been able to share in the political process," particularly black and poor residents of Washington.

Noting that government dollars to minority-owned firms more than quadrupled in the past decade, Barry said, "Never before and nowhere else in America will you find this degree of empowerment and participation by African Americans, Hispanics and women in so large a government or corporation."

The crowd of several hundred spectators interrupted Barry's speech with applause more than a dozen times, but the atmosphere of the day lacked the electricity that accompanied the mayor's campaign-style appearances at the Reeves Center earlier this year.

"It's always a little sad when you come to the end of an era, and this is the end of an era," said Gladys Mack, a former city budget director who serves as chairman of the D.C. Parole Board.

Not once did Barry sound maudlin in his speech, and he offered an optimistic vision of the city's future, saying he would "pass the mantle of leadership" to Dixon with "admiration and respect," as well as a sense of "relief, quite frankly."

Some in the audience, including senior citizens bused in from 16 residential centers across the District, said they thought Barry's speech was a fitting capstone to his career in public life.

"I liked the way he did things and I liked the speech," said Clarence Dickerson, 80, who lives at the Potomac Gardens housing complex in Southeast.

Minnie Gaskins, 68, who also lives at Potomac Gardens, said she believed history would treat Barry charitably.

"We all have troubles one way or another," Gaskins said. "I'm just sorry it had to end the way he did."