Keir Starmer was inaugurated as the prime minister of Britain on Friday following a decisive victory for his Labour Party in the general election.

“Across our country, people will be waking up to the news that a weight has been lifted, a burden finally removed from the shoulders of this nation,” Mr. Starmer told jubilant supporters in central London in the early hours of Friday morning.

Using the analogy of a rising “sunlight of hope,” he described the opportunity for the country to “get its future back” after 14 years.

Mr. Starmer replaces outgoing Prime Minister Rishi Sunak, who called to congratulate him. Starmer, a 61-year-old former human rights lawyer, has led a remarkable turnaround for Labour, pulling the party to the political center and capitalizing on the failings of three Conservative prime ministers.

Raised in a left-wing, working-class family in Surrey, outside London, Starmer was the first college graduate in his family, studying at Leeds University and then law at Oxford. He was named after Keir Hardie, a Scottish trade unionist and Labour’s first leader. As a young lawyer, he represented protesters accused of libel by McDonald’s and later became Britain’s chief prosecutor, earning a knighthood.

Elected to Parliament in 2015, he succeeded Jeremy Corbyn as Labour leader in 2020 and began reshaping the party. He dropped Corbyn’s proposal to nationalize Britain’s energy companies, promised not to raise taxes on working families, and committed to supporting Britain’s military. He also addressed antisemitism within the party, an issue that had plagued Labour under Corbyn. His wife, Victoria Starmer, comes from a Jewish family in London.

In his early morning speech on Friday, Starmer credited the party’s deep changes for the decisive victory but emphasized that the hard work was just beginning.

“I don’t promise you it will be easy. Changing a country is not like flipping a switch,” he said. “We will have to get moving immediately.”