Mahyeldi began his political activity following the
fall of Suharto, joining the newly formed
Prosperous Justice Party where he became the provincial chairman between 2002 and 2005. He took part in the
2004 elections and won a seat in the provincial council as deputy speaker. He then resigned to run in the 2008 local elections as deputy mayor with Fauzi Bahar as his running mate. Following their victory, he was made deputy mayor on 18 February the following year. In the next election on 2013, he ran with Emzalmi against 9 other candidates for mayorship. After securing just 29.45% of the votes in the first round, he won 50.29% of the votes in the runoffs. Despite an initial challenge to the
Constitutional Court, he was officially made mayor on 13 May 2014.
As mayor He established
pesantren in the
Ramadan in public schools on 2015 where it had formerly been held in mosques, and offered scholarships to students who had memorized sufficient
Juz' of the
Quran. In 2018, he led a march attended by thousands which denounced
LGBT individuals. During the rally, Mahyeldi declared his opposition to LGBT rights, stating that "To the perpetrators of sin, let them repent and those who protect them immediately be aware because they will face opposition from all parties and communities in Padang as well as security forces.”
As governor Mahyeldi was elected as governor in the
2020 West Sumatra gubernatorial election, winning 32.43 percent of votes. He was sworn in as governor on 25 February 2021. In 2024, Mahyeldi will run again as a candidate for governor of West Sumatra for the second time with his partner
Vasko Ruseimy supported by the parties
Prosperous Justice Party (PKS),
Great Indonesia Movement Party (Gerindra),
Democratic Party (Demokrat),
National Awakening Party (PKB) and other parties. == Honours ==