The result was never in doubt. The European parliament voted for the Brexit withdrawal agreement on Wednesday, sealing the UK’s divorce from the European Union after 47 years.

When the result flashed up on big screens in the Brussels debating chamber – 621 in favour, 49 against and 13 abstentions - MEPs broke into a chorus of Auld Lang Syne. Some were wearing blue and red scarves that merged the union jack and European flag together. Many linked arms. Most appeared to be joining in – a German MEP had circulated the words in advance.

It was a raw and emotional end to a banal debate that had begun two hours earlier, as MEPs sparred over unrelated points of order, such as whether the word “sustainable” should be used in an EU transport strategy.

But the mood soon turned sombre, as the European parliament’s Brexit pointman, veteran Belgian MEP Guy Verhofstadt opened the debate, putting the divorce papers on the table. “It’s sad to see a country leaving that twice liberated us, twice gave its blood to liberate Europe.”

The European commission president, Ursula von der Leyen, paid tribute to British civil servants working for the EU “who devoted their lives to Europe”, as well as British politicians who built European integration, such as former European commissioners Lord Arthur Cockfield and Roy Jenkins. The EU chief negotiator Michel Barnier also paid tribute to British MEPs, adding: “In this new beginning I would really and sincerely like to wish the UK well.”

But it was Von der Leyen, a graduate of the London School of Economics, who reached for poetry. “To our British friends and many – perhaps not all – but many of our British MEPs here in the room, I want to use the words of the famous British poet George Eliot. She said, ‘Only in the agony of parting do we look into the depth of love’. We will always love you and we will never be far.”

The debate turned raucous when Nigel Farage took the floor. Brexit marks the point of no return, he said. “Once we have left we are never coming back and the rest is detail.” At the end of his speech Farage and his Brexit party MEPs brandished miniature union jacks – forbidden under European parliament rules. They were reproached by Mairead McGuinness, the Irish European parliament vice-president, who was chairing the debate: “Please sit down and put your flags away …. and take them with you. You are leaving.” The Brexit party MEPs left the chamber, waving flags and opening bottles of sparkling wine.

Earlier in the day Farage said he would miss his leadership role in the parliament - he led a multinational Eurosceptic group for 15 years - a position that gave him a front-row seat in the parliamentary chamber, next to the presidents of the European commission. “In terms of choreography it was magnificent… And I will miss being the pantomime villain, the guy that gets up and 500 start booing.”

While a few far-right and Eurosceptic MEPs applauded Farage’s party, the mood turned more solemn after the Brexiters had left. Green MEP Molly Scott Cato spoke of her grief and regret. Her voice breaking, she said she hoped “one day I will be back in the chamber celebrating our return to the heart of Europe”.

Earlier in the day, Brussels marked a more low-key departure: the exit of the UK from the EU council of ministers. The council gets far less attention, despite being the EU’s most powerful legislative body, an arena where British diplomats set the agenda for a free-trading Europe, vetoed grand foreign policy schemes and haggled over fish quotas.

Diplomats applauded as the UK’s deputy ambassador Katrina Williams left the meeting room for the last time. “History. Switching off the UK microphone for the very last time,” she tweeted. “Over and out.” One non-British person in the room said it had been very emotional. “Brilliant speech by Katrina and standing ovations. Many tears.”

Back at the parliament MEPs were given wooden-framed certificates in tribute to their time as an MEP. Brexit party MEP Alexandra Phillips, still clutching her union jack flag, said she might hang hers in the toilet. Other British MEPs looked emotionally shell-shocked.

“It was a hundred times more emotional than I ever thought it would be,” said Labour’s Rory Palmer, who had ordered the blue and red scarves as gifts for friends and colleagues. He was surprised how popular they were, with many people wearing them and at least one already pinned on an office wall.

Labour’s 10 MEPs had been seated together for the vote, a surprise seating plan that intensified the emotion, he said. “There were tears, there were hugs, not just among the Labour MEPs, but among the Socialist group. It is a tremendously sad day for everyone who cares about the European Union.”