NEW YORK — The monthlong school bus strike that affected tens of thousands of children in the nation’s largest school district ended Friday, after union leaders were assured by prospective New York City mayoral candidates that their concerns would be heard after this year’s election.

Leaders of the Amalgamated Transit Union said service for New York City schools would resume Wednesday, after classes resume after the President Day holiday.

Some 8,000 bus drivers and aides walked off the job Jan. 16 over job protection issues. Local 1181 of the ATU wanted the city to include protections for current employees in future contracts with bus companies, but Mayor Michael Bloomberg said a court ruling prohibited the city from doing so.

“Though our strike has been suspended, the principles that we fight for remain pressing issues that the city will have to address,” said local union president Michael Cordiello.

The school bus strike was the first in the city since 1979. About 5,000 of the city’s 7,700 routes were affected.

Just 152,000 of New York City’s 1.1 million public schoolchildren ride yellow school buses but the cost of busing students has risen from $100 million in 1979 to $1.1 billion today.

On Thursday, five Democrats vying for the nomination to succeed Bloomberg as mayor next year sent the union a letter asking drivers to return to work. The candidates called on the bus drivers “to return to their jobs and continue the battle in other ways.”

The candidates — City Council speaker Christine Quinn, Public Advocate Bill de Blasio, City Comptroller John Liu, former City Comptroller Bill Thompson and former Councilman Sal Albanese — said that if elected they will revisit the job security issue.