HE WAS imprisoned for months for protesting, as a student, against the dictatorship of Park Chung-hee in the 1970s. But it was mass demonstrations against the late strongman’s daughter, Park Geun-hye, that brought Moon Jae-in to the presidency. On May 9th South Koreans chose the former dissident as their new president, after the constitutional court prompted a snap election by removing Ms Park from office. Mr Moon, who was sworn in as soon as the votes had been counted, is South Korea’s first left-of-centre president in almost a decade. He won 41% of the vote in a field of 13 candidates. His 17 percentage-point lead over the runner-up, a conservative, is the biggest winning margin ever in a South Korean presidential election.

Mr Moon’s victory was no surprise: he had led the polls for four months. Support for his liberal Minjoo party hit a record during the campaign, which reaped the benefits of South Koreans’ bitter disappointment with Ms Park, a conservative, who was elected in 2012. Parliament impeached her in December, following revelations that she had divulged state secrets to a friend, let her meddle in policy and colluded with her to extort bribes from big companies. Ms Park is now in jail, while a trial related to those charges proceeds. Over 77% of citizens voted in the election, the highest turnout in 20 years. (Ms Park, in her cell, chose not to.)

Kim Hyung-jun, a young father who took his toddler to a polling station in central Seoul on May 9th, said that he was voting to create a better society for his daughter: one “where everyone begins at the same line”, not where “the rich and powerful have a head start”. Expectations are high for Mr Moon, who can serve only a single five-year term, to see through the reforms that he has promised. One is to root out the corruption that results from close links between government and big business, in order to make society fairer. That has struck a chord with disenchanted young people in particular: over half of voters in their 20s and 30s cast their ballot for him, according to exit polls.

Committees to the rescue

Mr Moon plans to set up a “truth committee” on the presidential scandal. Another promise is to help youngsters get jobs, which many think are unobtainable without the right connections. He has established a job-creation committee, and says he will generate more than 800,000 jobs, mainly in the public sector, a third of which will be reserved for the young.

The new president grew up poor. His parents are refugees from Hungnam, a North Korean port evacuated in 1950 shortly after the start of the Korean war. He began his political career as chief-of-staff to the late Roh Moo-hyun, a liberal president in office from 2003 to 2008, with whom he had set up a law firm in the 1980s to take on human-rights cases. Mr Moon then ran for the presidency himself in 2012, and narrowly lost to Ms Park in a two-way race.

The challenges he faces are formidable. Donald Trump has stoked tensions with the North, even as he has said that the South should pay for an American missile-defence system, known as THAAD, intended to thwart a northern attack. Mr Moon says he wants to review the deal that led to THAAD’s deployment. He has also said he would go to Pyongyang to seek better ties with the North if the circumstances were right, suggesting that he will revive the old liberal policy of “sunshine” towards the North, which involved great emollience and lashings of aid.

But since those days North Korea has tested five nuclear devices and scores of missiles, while ramping up its threats. Scott Snyder of the Council on Foreign Relations, an American think-tank, says that resolutions passed by the UN Security Council prevent the sort of economic deals struck when Mr Moon worked under Roh. Mr Moon has adopted a less doveish tone than his liberal predecessors. And Mr Trump has said that he too would consider meeting Kim Jong Un, the North’s dictatorial leader.

Relations with China and Japan are also fraught. The Chinese government is unhappy about the deployment of THAAD, and has encouraged a boycott of South Korean goods. Japan, meanwhile, resents the apparent rekindling of anti-Japanese protests tied to its conduct during the second world war. But simply having a president at all, after five rudderless months, may help dampen these rows.

At home, Mr Moon also faces difficult negotiations: Minjoo does not hold a majority in parliament, and the next elections do not take place until 2020. It may rejoin forces with the People’s Party, a centrist group that split from it last year. But the splittists support THAAD and oppose Mr Moon’s plan to reopen the Kaesong industrial complex on the border with North Korea, a sunshine initiative that Ms Park shut.

In his inaugural speech, Mr Moon said that opposition parties were “his partners in running the country”. He wants every region to be represented in his government, and says he will share more power with his cabinet. He also has woolly plans to set up an appointment system that takes public opinion into account in some way.

Nor are voters of one mind, despite Mr Moon’s resounding win. Hong Joon-pyo, the candidate of Ms Park’s former party, had a remarkably strong showing, winning 24%. A “resentful pocket” of conservatives, says Shin Gi-wook of Stanford University, has formed around Mr Hong. He has referred to civic organisations, many of which led protests against Ms Park, as “thieving bastards”; his campaign slogan promised a South Korea free of “pro-North leftists”. This old-school conservatism still resonates, particularly in Gyeongsang—an eastern region that has long been a conservative stronghold—and with the elderly: half of those over 60 voted for Mr Hong.

On his first day in office, Mr Moon spoke to the heads of all four opposition parties. In his victory speech, he promised to be a “president for all”. Fulfilling that ambition is likely to be his hardest task.