After Józef Piłsudski's May 1926 coup d'état, on 1 June 1926, Mościcki, once an associate of Piłsudski in the Polish Socialist Party, was elected president of Poland by the National Assembly on the Piłsudski's recommendation after Piłsudski had refused the office for himself.