What granted Canada independence?

Canada officially became an independent country on 1 July 1867 when the British North America Act, now known as the Constitution Act, was passed by the British Parliament. This act united the colonies of Canada (Ontario and Quebec), Nova Scotia, and New Brunswick into a new federal dominion within the British Empire, known as the Dominion of Canada. Over the years, Canada gained more and more autonomy from Britain, until finally achieving full legal independence with the passage of the Canada Act in 1982, which allowed Canada to amend its own constitution without needing approval from the British Parliament.