McLeish resigned as Blues boss after three and a half years at St Andrew's last month and eventually took charge at Villa as Gerard Houllier's successor.
Birmingham, who have already appointed Chris Hughton as their new boss, demanded Villa pay them compensation for the remaining two years of McLeish's contract and initially threatened legal action.
But the possibility of a battle between the two clubs has now been removed via confirmation in a statement issued by City.
Birmingham's joint first team coach, Peter Grant, and chief medical officer, Dr Ian McGuinness, are also moving to Villa.
But other members of McLeish's backroom staff, joint first team coach Andy Watson and goalkeeping coach Dave Watson, are not following them to Villa Park.
The statement reads: "Birmingham City and Aston Villa can confirm that agreement has been reached between the parties ending the legal disputes surrounding Alex McLeish's departure.
"Aston Villa has agreed to pay Birmingham City an undisclosed figure following negotiations whereby the parties have agreed to bring to an end all disputes, including the further recruitment of Peter Grant and Dr Ian McGuinness by Aston Villa."
McLeish will now be able to concentrate fully on reviving Villa's fortunes and winning over the sections of supporters who protested against his appointment.
He may yet be able to do that with the services of Stewart Downing, as it is believed the club have not received any bid from Arsenal for the winger and are determined to keep him.
The Gunners are reported to have joined Liverpool in the race to sign Downing, who made it clear when on England duty last month that he will not be signing a new contract with Villa.
But sources close to the midlands club insist any possible interest has not been firmed up so far and McLeish wants to keep the former Middlesbrough player.
Villa have already rejected bids of £12million and £15million from Liverpool for Downing, who has two years remaining of his current contract.
If Villa find they are eventually left with no option but to sell Downing, then they will hold out for their original valuation of £19million.
Wigan's Charles N'Zogbia has been linked with Villa as a possible replacement should Downing leave.
McLeish came close to signing N'Zogbia last summer when in charge of Birmingham before a change in his wage demands ended hopes of the deal being completed.
Villa are also monitoring West Ham midfielder Scott Parker, although no bid has been made.
But the club finally expect the signing of Manchester City goalkeeper Shay Given to go through at some stage this week in a £3.5million deal.