The settlement of modern Toronto began in 1793 when Lieutenant Governor John Graves Simcoe built a garrison on the present site of Fort York. Fearful of war with the United States, Simcoe planned to establish a naval base at York (Toronto) in order to control Lake Ontario. Simcoe also moved the capital of the Province of Upper Canada to York (Toronto) from the exposed border town of Newark (Niagara on the Lake) in 1797. Civilian settlement followed and a community named York began to grow two kilometers east of the fort (York was renamed Toronto in 1834). In 1812, the United States declared war and invaded Canada. On the 27th of April 1813, the U.S. Army and Navy attacked York with 2,700 men on 14 ships and schooners. The defenders put up a strong fight but fell back to Fort York in the face of overwhelming odds, eventually abandoning the fort and town to the enemy. In the autumn of that year, the British returned to Toronto and built the fortification that stands today. Fort York's cannon and earthworks became obsolete in the 1880s, although the army continued to use the fort for training, barracks, offices and storage until the 1930s. Fort York opened as an historic site museum in 1934. Today, Fort York is home to Canada's largest collection of original War of 1812 buildings.
Photo shows the West Gate and it was protected by a dry moat, earthworks, and cannon. The earthworks date from 1805 and represent one of the few surviving elements of the original fort prior to capture and destruction in 1813.
Information about Fort York can be found here: http://www.fortyork.ca/