Mayor Lori Lightfoot’s plan to establish zoning ground rules for the sale of recreational marijuana in Chicago cleared the City Council Wednesday, despite lingering demands for minority ownership.

The City Council’s 20-member Black Caucus had threatened to hold up the ordinance over concerns that African-Americans have “zero representation” among the owners of 11 medical marijuana dispensaries that would get a running start when recreational weed sales begin Jan. 1.

They would be allowed to immediately pivot to recreational marijuana sales during the first year of legalization and have the exclusive right to open a second location until late spring, when new businesses would finally get a chance to bid.

But when aldermen reconvened Wednesday on the morning after a marathon Zoning Committee meeting, the mayor’s revised ordinance was approved by a vote of 40 to 10.

It was a hard-earned victory for Lightfoot, whose top aides lobbied hard to avoid a delay that could have cost the city sorely-needed revenue.

“This is a good day for Chicago,” Lightfoot said from the rostrum.

The mayor said she sympathizes with the demand for minority ownership and told aldermen, “I will be your partner” in seeking redress from the Illinois General Assembly.

Ald. Jason Ervin (28th), chairman of the City Council’s Black Caucus, said he’s “prepared to work with the legislature, the mayor to find a solution ... so equity looks like what equity really should look like.”

Any legislative fix must close “loopholes” that give the owners of recreational marijuana dispensaries social equity credit without real minority participation, he said.

“Social equity means ... ownership. People who look like the folks standing up here having an opportunity for ownership. Not participating as workers,” Ervin told a news conference before Wednesday’s vote.

“This is probably the biggest wealth generator in this state for years to come. And for African-Americans to not have a serious piece of that is a problem.”

But during final debate on the floor of the City Council, Ervin warned his colleagues not to forfeit their right to establish zoning ground rules for the sale of recreational marijuana that will begin on Jan. 1, with or without those rules.

“If we decide not to deal on zoning, we’ll be opening the door for these places to go where you don’t want them,” Ervin said.

Ald. Anthony Beale (9th), the mayor’s most outspoken City Council critic, strongly disagreed. He wanted African-American aldermen to flex the muscle they have.

“You’re cutting us out. We’re just saying, cut us in. ... Don’t give everybody a head start at the expense of our community. Why are we gonna start the game and we’re already 22 points behind?” Beale said.

Aldermen voting “no” with Beale were: Sophia King (4th); Leslie Hairston (5th); Marty Quinn (13th); Ray Lopez (15th); David Moore (17th); Jeanette Taylor (20th); Howard Brookins (21st); Silvana Tabares (23rd); and Anthony Napolitano (41st).

Wednesday’s smooth sailing was a sharp contrast to the night before.

On Tuesday, the Zoning Committee was brought to a two-hour halt as members of the Black Caucus met privately to discuss Lightfoot’s latest zoning proposal covering where legal pot shops will be able to operate.

Representatives from the mayor’s office and other aldermen ultimately met with caucus members; that led to a series of changes to the plan, such as making the proposed downtown “exclusion zone” smaller and giving aldermen more control over pot zoning.

The revised version of Lightfoot’s zoning plan would prohibit recreational weed sales in the Central Business District. The original proposal’s “exclusion zone” for pot shops would have stretched from Oak Street to Ida B. Wells Drive and from Lake Michigan to LaSalle Street in River North and to the Chicago River in the Loop.

The modified ordinance prohibits those sales north of the river and west from the lake to State Street; the old western limit had been farther west, at LaSalle. The northern boundary was moved north to Division Street from Oak Street.

Under the plan approved Wednesday, the southern boundary of the weed-free zone would be moved north from Ida B. Wells Drive to Van Buren Street.

Downtown Ald. Brendan Reilly (42nd) said Wednesday he would have preferred a “more permissive” ordinance that would have yielded more money for the cash-strapped city.

Obviously referring to the city’s $838 million shortfall, Reilly said the city is “staring into a fiscal abyss” and every dollar raised from recreational pot is a dollar that need not come from beleaguered Chicago taxpayers.