Henry L. Marsh III, a veteran civil rights lawyer who had become one of Virginia's top black officeholders, was ousted as the mayor of Richmond today in a political coup that was engineered largely by a handful of white politicians and businessmen.

The reign of the controversial Marsh, who has governed this city with a tenuous 5-to-4 City Council majority since 1977, abruptly ended this morning at a tense council meeting. Roy A. West, a newly elected black city councilman and political novice, teamed up with four white council members to depose Marsh and elect himself mayor.

The outcome shocked many community leaders, some of whom predicted that it might increase racial tensions in this city, the former capital of the Confederacy. "A lot of black people are really angry over this," said the Rev. Benjamin Campbell of the Richmond Urban Institute, a biracial community organization. "They feel like this is something done to them. They feel like this is a white plot to get a black man."

Those feelings were fed by a bitterly disappointed Marsh in a statement that castigated "segments of the white community" -- a thinly veiled reference to the city's Main Street business establishment that long has been hostile to his rule.

"Time after time, we have bent over backwards to win this white support and yet apparently we have failed," Marsh said after the vote.

On Main Street itself the mood was one of jubilation, with some business leaders predicting improved racial harmony in the city. "I'm delighted, obviously," said Henry Valentine, a stockbroker, Republican Party fund-raiser, and former vice mayor. "All we want is intelligent, responsible leadership. Henry had his chance and he blew it."

There was also a personal twist in Marsh's defeat. West said state Sen. L. Douglas Wilder, the city's flamboyant senior black legislator and Marsh's law school roommate, abandoned the mayor during a meeting yesterday and urged him to take his job.

West, a middle school principal who had never held elected office, moved quickly today to reassure blacks that he would not be a figurehead for the whites who put him in office. "I'm my own man," he said in an interview. "I always have been."

The defeat of Marsh marked the end of a stormy five-year period in the history of Richmond, now 51.9 percent black. As the city's first black executive, Marsh had turned the largely ceremonial and part-time mayor's job into a power base that had helped him achieve national prominence as an urban spokesman. His close ties to the Carter administration -- he was a frequent guest at White House dinners and other Washington cultural events -- had helped win the city millions of dollars in federal grants and awards.

At City Hall, Marsh vigorously tranformed a white-dominated government, replacing dozens of white civil servants -- including the city manager -- with blacks.

The 48-year-old Marsh, who as a lawyer had brought some of the state's major civil rights law suits, always considered himself a moderate in race relations, and many white leaders had agreed. Nevertheless, his efforts to give blacks "a piece of the pie" came at a price: The council's white minority, closely aligned with conservatives on Main Street, resolutely resisted his initiatives, producing squabbling that frequently stalemated the city government.

The turning point came on the night of May 4 when West, backed by the city's largely white political organization called Teams of Progress, won election to the council over a Marsh-backed incumbent. For the next seven weeks, West met with a steady procession of community leaders, including Main Street stalwarts such as Valentine and James C. Wheat, who offered him the mayor's job if he would vote to oust Marsh.

West said he finally made up his mind Wednesday night after he met with Wilder in the senator's law office. "It Wilder's support wasn't the major factor," West said, "but it was one of the factors."

The loss of Wilder's support was a painful blow to the mayor -- the two had grown up within a few blocks from each other on Richmond's Church Hill, roomed together at Washington's Howard Law School, and had been staunch allies during the civil rights battles of the l960s.

"Senator Wilder and I are good friends," Marsh had said in an interview. "The press has tried to create this rivalry . . . but there's no friction between us whatsover."

Yet, when Marsh called Wilder at 9 a.m. today, he learned for the first time of West's decision. Marsh, still visibly shaken two hours later, refused to comment on what Wilder had told him. "You'll have to ask Senator Wilder," he said. "He's an articulate man."

Wilder said today he told West he should "come away with something" -- either Marsh's job or that of vice mayor. "If he interpreted that as saying he should be mayor, then, yes. . . . I encouraged him I did not discourage him.

"I don't want it to appear that I have any axe to grind with Henry," Wilder said. "We've been friends throughout. . . Any differences I have with Henry are of the mind; not the heart."

After five years of rule, Marsh is now relegated to the status of one of nine council members. But in his statement, read slowly and painfully after the vote, he indicated he did not plan to abandon his role as a leader.

"What has happened today is a disappointing setback, but not a total defeat," he said. "We will now recommit ourselves to the battle and because our cause is just and the Lord is on our side, we will ultimately prevail."