CONCORD, N.H.  — New Hampshire is getting a $1.4 million federal grant to improve 42 miles of rail line in the Northcoast Railroad Project between Rochester and Ossipee.

The grant will help the railroad expand its freight service.

New Hampshire’s congressional delegation and state officials had advocated for the Transportation Investment Generating Economy Recovery grant, which was announced Wednesday.

“The Northcoast line connects to the national freight rail network via Boston and is a vital link for an economically-distressed area of our state,” the delegation wrote in a letter to Transportation Secretary Ray LaHood in May. “These repairs will complete a multi-year effort to modernize the rail line undertaken in partnership with the local community and the private sector.”

The delegation wrote the upgrades to the track will improve safety and reliability while enabling increased speeds for trains.

The repairs would allow car shipments of up to 286,000 pounds, the North American standard, to travel the full route.

“The higher weight limit will enable existing customers to more efficiently access markets and help spur economic growth in the region,” the letter said.