D.C. Mayor Marion Barry, a lifelong Democrat, quit his party yesterday to preserve his option of running as an independent for an at-large seat on the D.C. Council in November.

Barry, who awaits sentencing for his conviction on one count of cocaine possession, declined to say whether he would run for the council or any other office. He said he changed his party status, after nearly 12 years as nominal head of the D.C. Democratic Party, "in order to keep my options open."

Flanked by a battery of television cameras, Barry entered the D.C. Board of Elections and Ethics office shortly after 3 p.m. and filled out the city's one-page voter registration form, checking off the box listed "No Party," or independent.

Barry missed the deadline for running as a Democrat while standing trial on drug and perjury charges, and yesterday was the last day he could change his party affiliation to qualify to petition to appear on the Nov. 6 ballot as an independent. He has until Aug. 29 to gather the signatures of 3,000 registered voters necessary to appear on the ballot.

The mayor appeared ebullient, as he has since a federal jury on Friday found him guilty of one count of cocaine possession, not guilty of a second count and announced it was unable to reach a decision on the remaining 12 charges against him, resulting in a mistrial on those charges.

In a speech to his supporters Saturday, Barry apologized to the city and his wife "for any hurt I may have caused" and urged an end to racial polarization that he said has divided the community. On Sunday night, appearing at a gospel music workshop at the Washington Convention Center, Barry warned black Americans against unspecified attacks from "satanic" forces.

"All is not well in our land," Barry told the audience. "Satan and satanic forces are everywhere, trying to destroy all that which we've built up. Particularly if you're African-American, you better watch out. Whether you have a PhD or no D, you better watch out. Whether you have a DS-15 or a DS-2, you better watch out."

Lurma Rackley, Barry's press secretary, said yesterday that the mayor would have nothing further to say about those remarks. Rackley said Barry was speaking to religious people who "understand the language . . . . He was just making a statement of fact, that there are forces of good and forces of evil working in everybody's life."

Barry, 54, has told associates in recent weeks that he was extremely interested in seeking one of two at-large council seats up for election this year, assuming he wasn't convicted of the more serious felony charges of perjury.

After last week's mistrial, his political allies said Barry was looking at that race with renewed interest. Barry declined to comment on the possibility yesterday, saying only that "I have a lot of options."

Barry complained about published speculation that he might be persuaded not to run if special legislation were crafted by the end of the year to preserve his pension. Barry, who has spent his career in the civil rights movement and government, needs four more years of government service to secure full pension benefits.

"Those who have said that my stand in politics is just for the pension are insensitive, insulting and just plain insane," Barry said. "Money has never been my primary motivation. Community service was."

Barry's change in party affiliation was criticized by Joslyn N. Williams, a labor leader and chairman of the D.C. Democratic State Committee, the ruling arm of the local party. Williams said "there was no reason for him to leave the party except for personal ambition."

"One must wonder whether his actions were done for the benefit and welfare of the city and whether he really reflected on this action," Williams said. "If the mayor had truly, truly reflected over this, he could not have come to the decision that he did."

Last May, members of the state committee narrowly defeated a resolution offered by Williams urging Barry not to seek a fourth term.

Ronald H. Brown, chairman of the Democratic National Committee, was more muted in his reaction, saying, "Today's events do not alter the fundamental political issues in the District of Columbia.

"We assume that this decision to file as an independent was based on the fact that the deadline to file as a Democrat has passed," Brown said in a statement. "The Democratic Party nonetheless remains the best vehicle to advance the concerns of the residents of the District of Columbia.

Local politicians viewed Barry's move warily.

"Anybody who wants to run for city council can run for city council. I don't have any opinion on it," said council member John A. Wilson (D-Ward 2), who is favored to become council chairman. "He's eligible."

Council member Frank Smith Jr. (D-Ward 1) said there is sentiment on the council to try to help Barry obtain his pension through legislative means, but said that sentiment "would diminish considerably if he got into a divisive race, and especially if he lost."

"I would have hoped he would have chosen a more positive way of working things out," Smith said.

Barry said that his move was "not an easy decision, because my roots go deep in the Democratic Party . . . . I still believe very much in the progressive ideals and principles of the Democratic Party."

The mayor disclosed at his news conference that he intends to go on vacation in a few days, and he asked reporters not to try to determine his whereabouts or to try to "ambush" him. A spokeswoman said later that Barry is expected to leave the city by tomorrow, and will be gone for at least a week and a half.

Meanwhile, Democratic mayoral candidate John Ray received the endorsement of the AFL-CIO-affiliated Food and Beverage Workers Union's Local 32, which represents about 2,500 District residents. Members of the union work in cafeterias, laundries and catering businesses.

Ray said the endorsement was "extremely important to me in a real personal way" because many members of his family are employed in similar areas.

Union members endorsed Ray mainly because of his strong stance on crime, said Minor Christian, the local president. The endorsement "was generated from the rank and file," Christian said. "There has not been some deal cut in the back room. It came from the bottom and worked to the top."

Staff writer David Mills contributed to this report.