The thirteen American colonies declared their independence from Britain in seventeen seventy-six. But they had to win their independence in a long war that followed. During that war, the colonies were united by an agreement called the Articles of Confederation.