OTTAWA — Prime Minister Mark Carney has secured a majority government after three byelection wins.