In a victory for Mayor Kenney and his signature programs, the Pennsylvania Supreme Court on Wednesday upheld Philadelphia's controversial tax on soda and other sweetened beverages.

In a 4-2 majority opinion, the court found that the city had not violated state law by taxing the distribution of beverages. Opponents of the tax had argued that the levy amounted to double taxation because it is passed down to consumers who already pay sales tax on the items.

The ruling provided a more secure future for the 1.5-cent-per-ounce tax that funds pre-K, community schools, and improvements to parks, libraries, and recreation centers, and ended a case that had been closely watched since Philadelphia became the first big U.S. city to pass a tax on soda and sweetened beverages in 2016.

Yet the decision will not end opposition to the tax. The American Beverage Association has poured millions of dollars into fighting it and similar taxes nationwide, and the levy will likely become a key issue in the 2019 mayoral race, as Kenney runs for a second term.

Expansion of the programs that the tax funds had been put on hold while the case worked its way through the court system. With the case behind him, Kenney said Wednesday that the city would move to spend revenue — an estimated $56 million, according to the city's five-year plan — that had been reserved while the litigation was pending.

"These programs, funded by the beverage tax, will fuel the aspirations and dreams of those who have waited too long for investments in their communities," Kenney said in a statement. "The City of Philadelphia will now proceed expeditiously with our original plans — delayed in whole or part by nearly two years of litigation — to fully ramp up these programs, now that the legal challenge has been resolved."

City officials said more community schools and pre-K seats were set to open in fiscal year 2020, which starts next July, but the city would consider whether that could be done earlier due to the decision. Kenney, who said worry over the legal battle had kept him up at night, said he was happy to get "the green light from the Supreme Court" to add to the 2,700 existing pre-K seats and 12 community schools.

Philadelphia spent $1.7 million on hiring outside counsel for the litigation, and received $500,000 from the Laura and John Arnold Foundation to offset that cost, according to the Law Department.

"We will stay focused on that path ahead," Kenney said at a news conference Wednesday afternoon. "Every day I hear from parents of children in pre-K, families, and seniors whose lives have already been improved."

The tax has raised less than initially projected, causing the city in March to lower its estimates by 15 percent and downsize plans for the programs it funds. The city projects the tax will raise more than $78 million in the current fiscal year, but revenue is expected to decrease over time as soda consumption declines. Officials have said that other money in the general fund will eventually be needed to cover a portion of those programs.

Arguments before the Supreme Court, heard in May, focused on a Depression-era law known as the Sterling Act that allows the city to tax anything not already taxed by the state. Lawyers for a group of local businesses, consumers, and trade associations argued that the city had tried to get around state law by passing a levy on beverage distribution rather than sales.

The Supreme Court disagreed, siding with the city.

"The legal incidences of the Philadelphia tax and the commonwealth's sales and use tax are different and, accordingly, Sterling Act preemption does not apply," Chief Justice Thomas G. Saylor wrote in the majority opinion.

The opinion affirmed a ruling issued last year by Commonwealth Court. Justices Max Baer, Debra Todd, and Christine Donohue joined Saylor in the majority. Justices David N. Wecht and Sallie Updyke Mundy each wrote dissenting opinions. Justice Kevin M. Dougherty, who is from Philadelphia, did not participate in the case.

Wecht, in his dissent, called the idea that the tax is levied on beverage distribution "convenient fiction," writing instead that taxing distribution of beverages specifically intended for retail sales is an illegal duplication of the sales tax.

"A rose by any other name smells just as sweet, and, whether styled a retail tax or a distribution tax," he wrote, the tax at issue ends up "burdening the proceeds from the retail sale of sugar-sweetened beverages."

Shanin Specter, a lawyer who represented the group challenging the tax, said he was disappointed by the decision. Anthony Campisi, a spokesperson for the Ax the Philly Bev Tax Coalition, continued to criticize what he called a "wildly unpopular beverage tax."

"It is now up to our elected officials to listen to the concerns of their constituents and provide Philadelphians much-needed relief by reversing this tax," Campisi said.

Former New York City Mayor Michael Bloomberg's Bloomberg Philanthropies, which has contributed financially to supporting taxes on soda in Philadelphia and other cities, praised the court's decision.

"We urge other cities across the country and around the world to follow Philadelphia's example and put consumers' health ahead of industry profits," said Kelly Henning, head of Bloomberg Philanthropies' public health programs.

In the majority opinion, Saylor noted that the legislature has the power to limit Philadelphia's taxing powers, writing, "For whatever reason … the General Assembly has left extant the 'enormously broad and sweeping power of taxation' granted to the city by the Sterling Act."

A bill that would preempt and eliminate the city's beverage tax is pending in the Pennsylvania House. Its sponsor said last week that there was no "realistic shot" to pass it before the end of the legislative session, but opponents of the tax continued to call for its passage after Wednesday's court decision.

Danny Grace, secretary-treasurer for Teamsters Local 830, which has members who work in bottling plants and deliver beverages to retailers, said Wednesday that he was disappointed by the ruling because he opposes the tax and "the economic harm it is reaping on the beverage industry, small businesses, consumers, and my union."

"Unless proposed state legislation that would preempt municipalities from enacting their own taxes gains some traction in Harrisburg, this is the grim new reality we must accept," Grace said.

City Council President Darrell L. Clarke said he was grateful and relieved that the litigation over the tax has ended.

"I have always been sympathetic to the Philadelphians most affected by this tax — from small corner store owners to low-income consumers — and I will continue to insist that the economic benefits of the Philadelphia Beverage Tax be invested first and foremost in our most vulnerable communities," Clarke said in a written statement. "Healthy, educated kids and inviting public spaces will ultimately benefit us all."