During colonial times, Edenton served as the state capital beginning in 1722, and New Bern was selected as the capital in 1766. Construction of Tryon Palace, which served as the residence and offices of the provincial governor William Tryon, began in 1767 and was completed in 1771. In 1788 Raleigh was chosen as the site of the new capital, as its central location protected it from attacks from the coast. Officially established in 1792 as both county seat and state capital, the city was named after Sir Walter Raleigh, sponsor of Roanoke, the "lost colony" on Roanoke Island.