Lex returned to the Infantry Life Regiment in late 1916 as a company commander, but in 1918 he was transferred to an office in the Bavarian War Ministry after his three brothers were killed in action.
He was a civil servant in the Bavarian Culture Ministry from 1921 to 1923 and from 1927 to 1932, with an interlude from 1923 to 1927 as a district attorney in his hometown of Rosenheim.
After his release, Ritter von Lex became a civil servant in the Reich Ministry of the Interior, responsible for sports affairs.
After World War II, in 1946, Ritter von Lex became a senior civil servant in the Bavarian Interior Ministry.
After his death, the German border guard (Grenzschutz) renamed its barracks in Rosenheim the "Grenzschutzunterkunft Hans Ritter von Lex"