Jeremy Corbyn has confounded his critics by winning a Labour leadership contest for the second time in two years.
His victory, announced in Liverpool, was broadly expected following a exhausting contest that has tested Labour's unity to its absolute limits.
But the result, greeted with cheers of jubilation from his supporters, now leaves Mr Corbyn with a huge choice over whether to use his mandate to stamp his authority on the party's direction or strike a more conciliatory tone.
His approach could become clear later this afternoon when he is due to attend a meeting of Labour's ruling National Executive Committee, where MPs have tabled plans to give the parliamentary party more say in selecting his team of shadow ministers.
Mr Corbyn has said he will try to build a new relationship with MPs, but before his victory was announced warned them they had “a responsibility to work within the democracy of our party and respect the leadership of whoever is elected.”
He went on: "We owe it to the millions of people Labour exists to represent to end the sniping and personal attacks, and work together for all those who depend on the election of a Labour government. Anything else would be destructive self-indulgence.”
Earlier this week the NEC failed to agree on proposals to allow MPs to elect members of the shadow cabinet, with Mr Corbyn's supporters accused of trying to delay the issue until the leadership result was clear.
The leader has been holding meetings with individual MPs in a bid to bring them back on to his team, but the extent to which he can tempt them may depend on how compromising he is on the issue of shadow cabinet elections.
A handful of MPs, some who previously served on his frontbench and resigned, are expected to accept offers to return to Mr Corbyn's team either way.
But others have made clear they will refuse, setting the scene for potential future clashes between the leader and the parliamentary party.
His win, confirmed just before noon, comes after two months of hard campaigning and heated debates between Mr Corbyn and his now-defeated rival Owen Smith.
The contest was also fought against a backdrop of internal strife, bullying and abuse claims, an alleged ‘purge’ of Corbyn-backers, an antisemitism crisis and even court battles.
Mr Smith's challenge as the ‘unity’ candidate had a rocky start when he had to fight off a rival bid from fellow MP Angela Eagle.
While he was scathing of Mr Corbyn's abilities and record, he also suffered setbacks, such as suggesting there should be peace talks with Isis. But it was Mr Smith's inability to dent the leader's support among party members that meant his challenge never gained momentum.
Many MPs who resigned from Mr Corbyn's frontbench as the coup took hold in late June following the Brexit vote, later claimed to have fallen foul of abuse from the leader's supporters. Mr Corbyn also claimed to have been the victim of abuse.
Shortly before she dropped out of the contest, Ms Eagle had a brick thrown through a window of her constituency office. Earlier this week another MP, Ruth Smeeth, said she had received thousands of messages of abuse including many which were antisemitic.
Mr Corbyn was forced to launch a review into alleged antisemitism in the party after the suspensions of a handful of members, including former London Mayor Ken Livingstone and MP Naz Shah.
Party HQ also suspended thousands of members over the summer for various alleged party-rule breaches, though Corbyn-backers claimed the drive was an attempt to purge them from the contest.
One court case was brought against the party hierarchy after it blocked members who joined this year, most Corbyn supporting, from participating in the leadership ballot.
Another case was brought by Labour donor Michael Foster who tried to overturn a decision of the NEC to allow Mr Corbyn on the leadership ballot without nominations from MPs. Both cases failed.