n 1845, Worcester was becoming an important railroad junction in central Massachusetts, with numerous rail lines linking the city to Boston, Springfield, Providence, Rhode Island, and Norwich, Connecticut, with another line linking it to Albany, New York. But there was not a rail link with the cities in northern New England.
The Worcester and Nashua Railroad was organized in 1845 to link Worcester to the growing mill city of Nashua. The line opened as far as Groton Junction (now Ayer) in July 1848 and to Nashua in December. The line opened up New Hampshire to southern and western New England and plans were made to connect the line with southern Maine.
The Nashua and Rochester Railroad was formed in 1847, extending a railway line to Rochester, New Hampshire, on the Maine border. The Worcester and Nashua (W&N) leased the Nashua and Rochester (N&R) in 1874, and the two companies merged into the Worcester, Nashua and Rochester Railroad in 1883. The Boston and Maine Railroad leased the line in 1886. This acquisition also included the continuation from Rochester to Portland, via the York and Cumberland Railroad which was formed in 1846. It opened to Gorham, Maine, in 1851 under the direction of Maine railroad pioneer John A. Poor and was extended in 1853. The York and Cumberland was reorganized as the Portland and Rochester Railroad in 1867, with a connection to the Grand Trunk Railway in Portland, and was completed to Rochester in 1871. The three lines were tied together by the B&M as its Worcester, Nashua and Portland Division and covered over 147 miles (237 km).