Members of the European Parliament have overwhelmingly backed the terms of the UK's departure from the EU.
MEPs ratified the Brexit Withdrawal Agreement by 621 votes to 49 following an emotional debate in Brussels.
After the vote, MEPs marked the UK's exit by singing Auld Lang Syne. Several British MEPs said they hoped the UK would return one day although Eurosceptics, including the Brexit Party's Nigel Farage, used their final speeches to tear into the EU.
The UK is due to leave the bloc at 23:00 GMT on Friday.
Ratification of the withdrawal agreement, agreed by the UK and EU in October, was not in doubt after it easily cleared its committee stage last week.
Signing the letter confirming the EU's consent, the Parliament's president, David Sassoli, said the two sides must heed the words of the late Labour MP Jo Cox when approaching their future relationship and recognise "there is more that unites us than divides us."
"You are leaving the EU but you will always be part of Europe…It is very hard to say goodbye. That is why, like my colleagues, I will say arrivederci."
Wednesday's session saw those on either side of the Brexit debate, including the UK's 73 MEPs, celebrate or lament the end of British EU membership.
Some MEPs marked the occasion with songs - others wore "always united" scarves. The Parliament's Brexit spokesman, Guy Verhofstadt, said it was "sad to see a country leaving that has twice given its blood to liberate Europe".
He added that British MEPs had brought "wit, charm, and intelligence" as well as "stubbornness", and would be missed.
President of the European Commission Ursula von der Leyen said ratification of the withdrawal deal was "only a first step" towards a new partnership between the EU and the UK.
The two should "join forces" in areas such as climate change, she said, and seek a close partnership following the UK's exit on Friday.
"We will always love you and we will not be far," she told the UK in closing.
The EU's Brexit negotiator Michel Barnier also wished the UK well, saying the bloc would approach talks on the future relationship with "patience" and "objectivity" while defending its members' interests.
On the other side, though, Conservative MEP and prominent Eurosceptic Daniel Hannan said opinion in Britain turned against the bloc when it became clear "the aspiration was to have the EU as a quasi-state".
"If at any stage Britain had been able to have a trade-only relationship that would have been enough," he went on, but added: "You are losing a bad tenant and gaining a good neighbour."
Mr Farage - who has been campaigning for the UK's exit since before he was first elected to the Brussels Parliament in 1999 - used his final speech to excoriate the EU.
"I want Brexit to start a debate right across Europe - what do we want from Europe?" he said, arguing that "trade, friendship, co-operation and reciprocity" between nations could be achieved without "all of these institutions and all of this power".
He and his fellow Brexit Party MEPs waved Union flags before walking out of the chamber en masse.
A tearful Molly Scott Cato was applauded and hugged by her colleagues after she spoke of her "grief and regret" at Brexit and the hope she would return to the European Parliament "one day".
"While now is not the time to campaign to rejoin the EU, we must keep the dream alive," the Green Party MEP said.
Belgian MEP Philippe Lamberts said the EU must learn lessons from the UK's decision to leave.
He said the bloc had to "regain the hearts and minds of European citizens" by focusing on what it could do for the many, not the few.
Earlier, the S&grin coalition, which houses Labour's 10 MEPs, displayed a sign aimed at departing British members, which read: "It's not goodbye, it's au revoir."
On Tuesday evening, several MEPs in the Green group also held a ceremony to mark the UK's departure.
While Brexit Party MEPs spoke of their joy and relief at leaving, others shared messages of sadness on social media as they prepared to vote for the last time.
The Green Party's Alexandra Phillips tweeted: "I'm devastated to be leaving the best job in the world.
Twitter post by @catherinemep: As the LDs attend their last @RenewEurope group meeting we exchange gifts, memories of campaigns we fought, lost and won. You will always be our friends, and we will one day return I am sure.
After the UK leaves, there will be an 11-month transition period in which the two sides hope to negotiate their future economic relationship.
Trade talks are expected to begin in earnest in early March. The European Parliament will also get a say in ratifying any future deal