In the 2017 election, Ahn emerged as a major threat to eventual winner Moon Jae-in, at one point polling nearly even with Moon before collapsing in polling and finishing behind conservative firebrand candidate Hong Jun-pyo with approximately 21.41% of the vote. In the 2020 National Assembly election, the People Party fared poorly, winning a mere 3 seats; in comparison, Ahn's previous outfit, the identically named People Party, won an unexpectedly large 38 seats in the 2016 National Assembly election. In the 2021 elections, Ahn ran for Mayor of Seoul, but, in a pre-negotiated deal with the PPP, pulled out of the race after losing opinion polls to PPP candidate Oh Se-hoon and supported Oh, who would go on to win the election.