Mayr's political career began under the Austro-Hungarian Empire, when from 1907 to 1911 he was a member of the Imperial Council (Reichsrat) legislature and from 1908 to 1914 of the Tyrolean Landtag assembly.
With the breakup of the Empire at the end of World War I, Mayr was in 1919/20 a delegate for the Christian Social Party to the National Assembly drafting the new Constitution of Austria.
On 20 November 1920, the newly established National Council parliament elected Mayr Chancellor of a Christian Social minority government.
He also remained Foreign Minister of the country, until the cabinet resigned on 1 June 1921, in response to a referendum that was called in Styria proposing that the state leave Austria and join Germany contrary to the 1919 Treaty of Saint-Germain-en-Laye.
Mayr was succeeded as chancellor by non-partisan Johann Schober, backed by the Christian-Socials and the Greater German People's Party.