A city lawmaker is pursuing legislation to make sure MTA subways never stop running.

Brooklyn Councilman Rafael Espinal is exploring legislation that would require the MTA to run 24-hour service in order to receive city funding. Espinal is looking into the City Council’s authority to do so following a report last week from an influential planning group, the Regional Plan Association (RPA), suggesting the service change in order to repair and maintain the beleaguered subway system.

“Twenty-four-hour subway service is a lifeline for so many New Yorkers who rely on the subway to get them where they need to go at any time of the day or night,” Espinal said. “This will hurt [the city’s] nighttime economy, further pollute our air quality because of an increased demand in taxis, and hurt middle income and lower income earners who are likely working the night shifts.”

Subway delays have soared over the past several years as the MTA has struggled to maintain its aging infrastructure. The RPA, in its generational report on a how to improve the region’s sustainability, recommends ending 24/7 subway service as part of a multi-pronged approach to fix what it describes as the MTA’s subway crisis.

Tom Wright, president of the RPA, argues the MTA should end overnight service from Monday through Thursday, when ridership is lowest, in order to allow work crews more time to make station and track upgrades. Under the RPA’s recommendations, the 85,000 commuters who rely on the subway between about 12:30 a.m. and 5 a.m. — which amounts to 1.5 percent of daily ridership — would be transferred to boosted bus service that would mimic the subway lines below.

“I know that 24/7 is a kind of badge of honor for New Yorkers. We think it’s something that we ought to change,” Wright said. “Riders during the rest of the day are all paying for the service to be open at 2 o’clock, 3 o’clock in the morning. We’re all paying for that now. We don’t see that, but we’re paying for that.”

The idea met forceful pushback from straphangers as well as officials, including Mayor Bill de Blasio and the MTA’s chairman, Joe Lhota.

“I believe a permanent closure of the entire subway system every night is a bit draconian,” Lhota said. “The MTA has successfully been closing certain subway lines in evenings and on weekends as needed for maintenance and repairs. A permanent closure, I fear, would be inappropriate for the ‘city that never sleeps.’ ”

The city is one of several sources for capital funding and has pledged $2.5 billion toward the MTA’s five year, $32.5 billion capital plan.

Dani Simons, spokeswoman for RPA, said the association would be “delighted” to brief the council on the array of proposals in its report.

“We’re glad some of the provocative ideas in our plan have sparked conversation, because we need to move quickly to fix the catastrophic condition of our subways,” Simons said. “We would be delighted to have the chance to brief the Council member and his colleagues on our other ideas to modernize and improve the transit system as well as the numerous other recommendations in the Fourth Plan.”

Espinal said that, even though Lhota opposes the measure, he wanted to ensure the idea of ending 24-hour service couldn’t gain traction in the future. He also pointed out that other cities, like London, are working to keep their subways open longer.

“While I commend the current MTA leadership and the mayor for rejecting the idea to close the subways at night,” he said, “we must ensure that this remains the standard policy now and in the future.”

Benjamin Kabak, who runs the Second Avenue Sagas blog, disagrees with the idea of ending 24-hour service on weeknights, but believes the MTA will have to execute temporary service outages to bring subway service to a higher caliber.

Still, Kabak described Espinal’s move as a misguided, “knee-jerk” reaction and added that politicians at both the city and state level should instead hold more oversight hearings to improve accountability. Neither the State Senate nor Assembly held one oversight hearing on MTA operations last year, according to watchdog group Reinvent Albany.

“It gets down a slippery slope of politicians telling the MTA how to run the subways,” Kabak said. “For Espinal to pursue this path he really has to be certain it’s the best option. As a knee-jerk reaction, I don’t think it is.”