New Jersey Transit is adding 40 train cars to relieve chronic crowding at the nation’s second-biggest commuter railroad.

The agency, with a fleet of more than 1,200 trains, had been operating short 37 cars needed to provide basic daily service, resulting in standing-room-only commutes and delays.

Governor Phil Murphy, a Democrat who took office on Jan. 16, said the agency is pulling half the 40 cars from its rail yards, where they had been undergoing tests of emergency-braking software. The rest will come from the Maryland Transit Administration in a lease agreement, he told reporters Thursday at the Trenton rail station.

“This is not a quick turnaround project,” Murphy said. “New Jersey Transit’s woes stem from years of internal management issues and years of state neglect.”

Murphy’s predecessor, Republican Chris Christie, cut NJ Transit’s annual bus and rail budget by as much as 90 percent during his eight years and transferred $3.44 billion from the capital account to cover day-to-day expenses. Even as fares increased by more than a third, reliability plummeted and passenger crowding increased. Once a national model, the railroad recorded the most accidents and highest federal fines among its peers, federal data show.

Facing a December 2018 deadline to install the federally mandated braking system known as positive train control, NJ Transit has suspended installations because of software troubles. Train cars that had been sidelined for those installations now will return to service with the software disabled, said Diane Gutierrez-Scaccetti, New Jersey’s acting transportation commissioner.