The war had its origins in the resistance of many Americans to taxes imposed by the British parliament, which they claimed were unconstitutional. Patriot protests escalated into boycotts and the destruction of a shipment of tea at the Boston Tea Party. The British government punished Massachusetts by closing the port of Boston and taking away self-government. The Patriots responded by setting up a shadow government that took control of the province outside of Boston. Twelve other colonies supported Massachusetts, formed a Continental Congress to coordinate their resistance, and set up committees and conventions which effectively seized power from the royal governments. In April 1775 fighting broke out between Massachusetts militia units and British regulars at Lexington and Concord. The Continental Congress appointed General George Washington to take charge of militia units besieging British forces in Boston, forcing them to evacuate the city in March 1776. Congress supervised the war, giving Washington command of the new Continental Army; he also coordinated state militia units.
In July 1776, the Continental Congress formally declared independence. The British were meanwhile mustering forces to suppress the revolt. Sir William Howe outmaneuvered and defeated Washington, capturing New York City and New Jersey. Washington was able to capture a Hessian detachment at Trenton and drive the British out of most of New Jersey. In 1777 Howe's army launched a campaign against the national capital at Philadelphia, failing to aid Burgoyne's separate invasion force from Canada. Burgoyne's army was trapped and surrendered after the Battles of Saratoga in October 1777. This American victory encouraged France to enter the war in 1778, followed by its ally Spain in 1779.
In 1778, having failed in the northern states, the British shifted strategy toward the southern colonies, where they planned to enlist many Loyalist regiments. British forces had initial success in bringing Georgia and South Carolina under control in 1779 and 1780, but the Loyalist surge was far weaker than expected. In 1781 British forces moved through Virginia, but their escape was blocked by a French naval victory. Washington took control of a Franco-American siege at Yorktown and captured the entire British force of over 7,000 men. The defeat at Yorktown finally turned the British Parliament against the war, and in early 1782 voted to end offensive operations in North America. The war against France and Spain continued however, with the British defending Gibraltar against a long running Franco-Spanish siege, whilst the British navy scored key victories, especially the Battle of the Saintes in 1782. In 1783, the Treaty of Paris ended the war and recognized the sovereignty of the United States over the territory bounded roughly by what is now Canada to the north, Florida to the south, and the Mississippi River to the west. France gained its revenge and little else except a heavy national debt, while Spain acquired Britain's Florida colonies.