FILES March 26, 2018 Brazil's defender Dani Alves AFP

It took a little over 24 hours for Barcelona and Dani Alves to reach an agreement that sealed the free agent's return to the Camp Nou, sources close to the negotiations told Reuters.

Barca announced the deal nL1N2S3231 on Friday and Alves, 38, will arrive in Spain on Saturday. After being cleared by the club's medical staff, the Brazilian will sign a contract until the end of the campaign with an option for another season.

The flirting between Alves and Barcelona started in October, when the veteran visited the city and went to the Camp Nou to attend the Champions League game against Dinamo Kyiv.

Alves had just become a free agent after terminating his contract with Sao Paulo following a dispute over unpaid wages.

He had been in Brazil since 2019 after a glittering 17 years in Europe with Sevilla, Barca, Juventus and Paris St Germain, becoming the most successful title winner in the history of soccer, having won a total of 45 honours including an Olympic gold medal as captain of Brazil at the 2021 Tokyo Games.

When in Barcelona in October, Alves had informal talks with club president Joan Laporta during which both men showed a mutual interest in him returning, but there were no negotiations mainly because the club was struggling and on the verge of cutting ties with manager Ronald Koeman, a source told Reuters.

Laporta kept the idea in mind, though, and, after signing Barca's former midfield great Xavi Hernandez as the new manager, bringing Alves back was one of the first topics on the table.

Barca are ninth in LaLiga with 17 points from 12 games after a difficult start and Xavi thinks Alves will bring leadership and experience that is missing in their young squad.

Xavi and Alves know each other well. They played together at Barcelona for seven seasons, from 2008 to 2015, and won 19 titles together, including three Champions Leagues.

With Xavi's blessing, club officials called Alves' agents on Thursday to schedule an online meeting for Friday. After a few hours an agreement was reached thanks to their mutual interest.

Alves agreed to keep the contract and salary to a minimum, helping Barca avoid breaching Financial Fair Play rules.

His objective is clear: the Brazilian wants to play at next year's World Cup when he will be 39.