Hundreds of advocates for marijuana legalization rally and smoke pot outside the White House on April 2, 2016. The D.C. Council on April 5 backtracked and banned pot clubs in the city. (Marvin Joseph/The Washington Post)

A divided D.C. Council voted on Tuesday to ban marijuana clubs, where residents and visitors to the nation’s capital might have smoked pot without fear of being arrested.

The 7-to-6 vote marked council members’ second about-face on the issue in four months and hinted at their unsure footing as they navigate fast-shifting public sentiment about marijuana use. The issue has become the next marijuana-policy frontier in the District and other places where voters have already legalized possession.

“They are doing the right thing,” D.C. Mayor Muriel E. Bowser (D) said Tuesday as she watched the vote surrounded by reporters in the press room at the District government building.

The ban was a victory for Bowser, who had insisted that marijuana clubs were the wrong next step for the city on legalization.

She found a willing partner in D.C. Council Chairman Phil Mendelson (D), who has also lamented open use of marijuana in the city since voters decided to legalize it in 2014.

Mendelson placed the ban on Tuesday’s agenda with the backing of council member Kenyan R. McDuffie (D-Ward 5), who has said he fears that the clubs could be dumped on constituents in his part of Northeast Washington, where most of the city’s medical marijuana dispensaries are located.

Bowser’s allies on the council — including many counting on her support in coming June primary elections — backed her.

The Marijuana Policy Project issued a statement denouncing the move as counter to “the freedoms that the vast majority of the voters support.”

The Drug Policy Alliance, which also advocates legalization, had made a civil rights argument for marijuana clubs, noting that they would have offered a sanctioned space for blacks and whites to enjoy marijuana.

Although arrests for marijuana in the District have plummeted over the past two years — from thousands annually to hundreds — one of the most common crimes involving marijuana is smoking it in public. And black residents are disproportionately charged with that crime compared with white residents.

Of 128 people arrested last year for smoking pot in public, 108 were black, according to arrest data that D.C. police recently furnished to the alliance under open records laws.

The crime is a misdemeanor on par with getting caught with an open container of alcohol and can cost an offender $500 and 90 days in jail.

The alliance argued that the District’s history of racial disparities in drug arrests highlighted the importance of marijuana clubs.

The group said clubs would give low-income residents, who are barred from smoking at home if they live in federal public-housing complexes, an indoor, legal place to smoke. African Americans make up a large majority of the city’s public housing residents.

The immediate impact of the council action was to throw into question the work of a task force that was to study whether and how the District might legally sanction a small number of pot clubs, perhaps as early as late this year.

Bowser was forced to agree to the study in February when several council members threatened to override her objections and license them. They said doing so better reflects what voters intended when they legalized marijuana in 2014.

But Bowser maintained that clubs were a bad idea. If the council approved them, other restrictions that Congress placed on the city — preventing it from taxing and regulating pot — would prevent the District from appropriately regulating the establishments, she said.

Bowser said she would still support having a task force study the issue. But pro-marijuana groups and several lawmakers asked why a task force should move forward if the city had already decided against clubs.

“Give the task force time to do its work,” said council member Brianne K. Nadeau (D-Ward 1) urging colleagues to stick with their votes from eight weeks ago to allow the task force.

Council member Vincent B. Orange (D-At Large) said the council was undermining its credibility in changing course so soon and giving away power to Congress.

Another restriction Congress has passed to tamp down legalization in the District prevents the city from loosening laws pertaining to marijuana. That means the council may not be able to undo a self-imposed restriction on clubs without approval from Congress.

Kaitlyn Boecker, a spokeswoman for the Drug Policy Alliance, issued a statement blasting the coordination between Bowser and Mendelson to scuttle the clubs.

“It’s bizarre and reprehensible that the chairman of our city’s legislative body and our mayor are actively and willfully ceding the District’s authority to control marijuana policy reform to Congress,” she wrote.