The area was inhabited by the Lenape at the time of its European discovery by Italian Giovanni da Verrazzano in 1524. Although Verrazzano sailed into New York Harbor, his voyage did not continue upstream and instead he sailed back into the Atlantic. It was not until the voyage of Henry Hudson, an Englishman who worked for the Dutch East India Company, that the area was mapped. He discovered Manhattan on September 11, 1609, and continued up the river that bears his name, the Hudson River, until he arrived at the site where New York State's capital city, Albany, now stands. The Dutch established New Amsterdam in 1613, which was granted self-government in 1652 under Peter Stuyvesant. The British took the city in September 1664, and renamed it "New York" after the English Duke of York and Albany. The Dutch briefly regained it in August 1673, renaming the city "New Orange," but ceded it permanently in November 1674.
Under British rule the City of New York continued to develop, and while there was growing sentiment in the city for greater political independence, the area was decidedly split in its loyalties during the New York Campaign, a series of major early battles during the American Revolutionary War. The city was under British occupation until the end of the war, and was the last port British ships evacuated in 1783.
New York City was the seat of the government under the Articles of Confederation from 1785 until 1788, and then the capital of the newly-formed United States from 1788 to 1790. In the 19th century, the opening of the Erie Canal in 1825 enabled New York to overtake Boston and Philadelphia in economic importance, and local politics became dominated by a Democratic Party political machine known as Tammany Hall that drew on the support of Irish immigrants. In later years, known as the Gilded Age, the city's upper classes enjoyed great prosperity amid the further growth of a poor immigrant working class. It was also an era associated with economic and municipal integration, culminating in the consolidation of the five boroughs in 1898.