(CNN) -- Spanish champions Barcelona have announced they've agreed a deal to sign Javier Mascherano from Liverpool.
The Argentina international asked to be sold in July and has recently been left out of Liverpool's squad as his drawn out move neared completion.
Mascherano is now expected to fly to Barcelona this weekend to put the finishing touches to a transfer believed to be in the region of $27 million.
A statement on Barcelona's official website read: "FC Barcelona and Liverpool FC have reached agreement in principle for the transfer of Javier Mascherano, who will join the club for the next four seasons.
"The agreement was reached after considerable effort from the club over the last few hours and the willingness and desire of the player to make the move.
"FC Barcelona will give more details of the operation once the player has gone through his medical and the transfer is definitive. Javier Mascherano is expected to arrive in Barcelona this weekend."
Mascherano played in Liverpool's opening English Premier League fixture with Arsenal, but did not feature in either of the club's next two games, as he tried to push through the deal.
He was signed from West Ham in January 2007 by former Liverpool manager Rafael Benitez -- now in charge at European champions Inter Milan.
New Liverpool coach Roy Hodgson had set a deadline of Sunday for the deal to be finalized, as the two clubs haggled over a fee.
Liverpool also confirmed the deal on their website: "Liverpool Football Club have agreed terms for the transfer of Javier Mascherano to FC Barcelona.
"The Spanish club have now been given permission to speak to the Argentina midfielder."