Following the assassination of Liberal-Conservative Member of Parliament Thomas D'Arcy McGee in April 1868, Ryan was selected by the party to run in the ensuing by-election. Due to the circumstances of the by-election Ryan's candidacy was unopposed and he was elected to the House of Commons by acclamation.
