The England midfielder had made it clear at the end of last season that he wanted to make the switch to Anfield and link up with his close friend Steven Gerrard, who was "desperate" for the move to materialise.

But Villa announced last night that the 27-year-old will be remaining with the midlands club after Liverpool failed to reach a 5pm deadline to meet their £18million valuation of the player.

Barry - also linked with Arsenal - and his agent are understood to have been part of the agreement involving "all parties."

Liverpool manager Rafael Benitez refused to comment on the situation when questioned after his side's friendly against Villarreal in Spain last night.

Now it remains to be seen whether Barry will continue as Villa captain - a role handed to him by manager Martin O'Neill two years ago - given his stated desire to leave throughout the past two months.

Martin Laursen led the side during the first leg of the Intertoto Cup clash with Odense BK with Nigel Reo-Coker taking the armband in the return meeting at Villa Park on Saturday.

Villa, in a statement, said: "Aston Villa can announce that Gareth Barry will be staying with the club following the interest from Liverpool over recent months.

"During discussions in the past few days, a final deadline to conclude this episode was set that all parties were aware of and agreed to. This deadline has now passed and so Gareth will remain with Villa."

Barry's outburst against O'Neill in a Sunday newspaper earlier this summer appeared to signal the end of any chance of him remaining at Villa.

He accused the former Celtic boss of finding time to be a pundit at Euro 2008 but not to speak to him. He was disciplined and told to stay away from Bodymoor Heath.

Then he was booed by Villa fans when he appeared at Walsall in a pre-season friendly last week.

But that mood had mellowed when Barry appeared as a substitute against Odense on Saturday and may allow him to rebuild bridges with fans who had previously idolised him.

Barry was keen to leave to experience playing Champions League football with Villa having under-achieved for the majority of his time at the club.

Now O'Neill will hope the player is in the right frame of mind to attempt to achieve that dream at Villa, who finished sixth in the Barclays Premier League last season.

Benitez made it clear in May that Barry was one of his major transfer targets for the 2008-09 campaign.

O'Neill was upset at him making details of his interest public and a war of words raged between the duo for much of the early part of the summer.

Liverpool made four separate bids to sign Barry but none of them were accepted by Villa.

O'Neill intimated a couple of weeks ago that the current situation could not continue indefinitely as he made his own plans for the new campaign not knowing whether or not Barry would be part of them.

Now he appears he has taken the situation by the scruff of the neck after Liverpool were unable to conclude the deal by the deadline apparently agreed.

There has been constant speculation that Benitez, who this week signed Tottenham striker Robbie Keane for £20million, would have to sell to finance the Barry deal.

(reopens)

O'Neill claimed last night's announcement brought "closure" to the whole affair and told the club's official website www.avfc.co.uk: "Naturally we're all absolutely delighted that Gareth will be staying at Villa Park and relieved to find a resolution and closure to the saga.

"We had a very positive meeting on Monday when it was agreed between Gareth, his agent (Alex Black), (club owner) Mr (Randy) Lerner and myself that a deadline should be communicated to Liverpool to finally resolve the situation.

"Liverpool were informed and that deadline came and passed. Now we can all look forward to the coming season with relief, anticipation and ambition."