He had voiced his desire to sign for Liverpool last summer and play Champions League football and Reds boss Rafael Benitez was expected to launch another bid after failing to match Villa's £18million valuation last year.
Barry's move to the Premier League's richest club is sure to go down badly with Villa fans, who initially booed him at the start of last season but came to respect his commitment to the cause.
In a letter to fans published in the Birmingham Mail, Barry said: "Once I had spoken to (City manager) Mark Hughes there was nowhere else I wanted to go. I was also desperate to avoid any long, drawn-out saga.
"I feel I am joining a club that will seriously challenge to win major honours. People might doubt that but I am convinced, with the plans the club has short term and long term and the backing the manager will receive from the owners, that we will be a major force.
"I have honestly been very undecided what to do, the (Villa) manager (Martin O'Neill) and the whole club have bent over backwards to try and persuade me to stay and made me a fantastic offer, which I am extremely grateful for."