Quebec was a province of Canada from 1861 until 1863, when the Quebecois declared independence from Canada. When the CSA agreed to help them gain independence, Canadians felt sure Quebec would win, so many switched to their side.
History of Quebec
Quebec in The North American Civil War.
When Quebec declared independence from Canada on June 16, 1863, within an hour the Siege of Montreal began. Quebec ultimately forced the Canadians hiding in there to surrender 5 days later, gaining themselves diplomatic recognition from the CSA. As they won battle after battle, Canadians finally gave up the war as a mistake.