It was a race to the finish in Hartford today, and New Haven beat state employees to the line.

On the last day of the fiscal year, legislators convened for a special session of the state’s General Assembly to hammer out a deal that would meet their constitutional obligation to balance the state budget by tomorrow. The session, called last week by Gov. Dannel Malloy when the collapse of a union concession deal burst a $1.6 billion hole in the budget, was expected to stem the flow of money from the state to cities like New Haven. But because of the efforts of House Democrats and municipal leaders across the state, cities will be spared — instead, up to 1,000 more state workers will lose their jobs.

The painful math of budget cuts came to a head in the state capitol, where legislators told Malloy they could not support giving him the authority to cut municipal aid, which would have dealt a fiscal blow to cities that have already set their tax rates.

Ahead of the special session today, Malloy recommended the layoffs of nearly 5,500 state workers and a reduction of municipal aid by $54 million. In order to make those cuts, he needed approval from the state legislature, which authorized him only to make cuts outside of municipal aid.

Lawmakers acknowledged after the session that without the $54 million in municipal aid cuts, Malloy would have little choice but to raise the number of state employee layoffs, the Connecticut Mirror reported.

There is still time, however, to avert the job cuts, which now total about 7,500 including 1,000 currently vacant positions. Because of layoff notice requirements in state law, most workers could not lose their jobs until late summer, giving union leaders and Malloy administration officials a window of opportunity to come up with an alternative solution to the budget gap.

While 11 of the 15 state unions and nearly 60 percent of state workers overall voted to approve the deal — which included a pay freeze and concessions on retirement and health benefits — labor leaders needed a self-imposed threshold of 14 unions and 80 percent overall approval for ratification.

Union officials announced Monday that they would be looking for ways to salvage the deal, though they tabled a vote on how to do so.