The Worcester and Nashua Railroad was organized in 1845 (opened 1848) and the Nashua and Rochester Railroad in 1847, forming a line between Worcester, Massachusetts, and Rochester, New Hampshire, via Nashua. The W&N leased the N&R in 1874, and the two companies merged into the Worcester, Nashua and Rochester Railroad in 1883. The B&M leased the line on January 1, 1886. This acquisition also included the continuation from Rochester to Portland, Maine, incorporated in 1846 as the York and Cumberland Railroad. It opened partially in 1851 and 1853, was reorganized as the Portland and Rochester Railroad in 1867, and opened the rest of the way in 1871. It was again reorganized in 1881 and then operated in conjunction with the line to Worcester.