Sir John A. Macdonald was the first Prime Minister of Canada and played a dominant role in Canadian Confederation, holding office for 19 years over three terms. He helped establish the Dominion of Canada on July 1, 1867 and oversaw the purchase of Western Canada from the Hudson's Bay Company. However, he was forced to resign in 1873 due to a corruption scandal before returning to power in 1878 with a promise to complete the transcontinental railway. In his final term from 1891, Macdonald's health declined and he suffered a stroke, passing away still in office.