As charter school operators and advocates exulted in their schools’ state test scores Wednesday, New York City officials emphasized that the city’s charter sector does not have their support to grow.

“Our focus should not be on the expansion of charters,” Mayor Bill de Blasio said after a press conference touting the city’s scores. “Our focus should be on doing the hard work of making our traditional public schools better.”

De Blasio’s answer — “The charter cap is perfectly sufficient the way it is” — was little surprise, given the mayor’s historical antipathy toward charter schools.

What was more notable was that schools chancellor Richard Carranza, who has occasionally sounded a more amenable note, echoed the mayor’s position. Carranza took the sector to task during a town hall later in the evening, saying charters have “absolutely picked off and preyed upon” district schools.

The officials’ tough stance hinted at the push-and-pull that the mayor and chancellor might anticipate next year in Albany.

De Blasio had been asked for his position on the charter cap, or the legal limit on the number of charter schools that can operate in the city and state. Under the current cap, the city can have up to 28 more charter schools — but operators want more and plan to push lawmakers to raise the cap.

That effort faces an uphill battle: Similar lobbying fell short in the past, and while the cap is closer to being exhausted now, the new crop of lawmakers in Albany is likely to be even less sympathetic to charter concerns.

The pair is teeing up to push a potentially more progressive legislature to increase school funding, at the same time as they fight for continued control of the city’s schools. To make both things happen — a long shot, given Gov. Andrew Cuomo’s position on school funding and pressure from both the right and left on school governance — they are likely to have to give something else up. The charter cap could represent valuable ground to hold in any negotiation.

“We should not be talking about lifting a charter cap,” Carranza said. “We should be talking about investing more resources from the state in fully funding our Fair Student Funding formula. That’s what we should be talking about.”

Later that evening, Carranza dug in his heels while speaking to a crowd gathered for a town hall at P.S. 163 in Manhattan’s District 3. Asked how the education department could help schools that compete with charters, the chancellor suggested he would take an aggressive approach — even while insisting he’s not “the enemy of charter schools.”

“What I’m saying is we need to take care of our own house,” Carranza said to enthusiastic applause.

He recounted visiting a school on the upswing, with a welcoming new principal and involved PTA, but no air conditioning and a “brand spanking new” charter school nearby. The district school, he said, “doesn’t have a chance.”

“We haven’t marketed the incredible things happening in that school,” he said. “The charter school is doing just that. So we’re getting out-hustled in our community. That’s going to change,” he promised.

Carranza alluded to a common accusation against charters, that they push out struggling students just before state testing time, before saying that the education department is zeroing in on schools that need additional help because of competition from charters.

“Whatever they have, we’re going to have it better,” he said. “We’re going to give our schools a fighting chance.”