The Canadian prime minister's Liberal Party took the most seats in Parliament, but it lost its majority.