Freshfields Bruckhaus Deringer and Linklaters are to pick up the bulk of the $260m (£197m) in legal fees incurred by Anheuser-Busch InBev (AB InBev) and SAB Miller on their £71bn deal.

The fees are believed to be the biggest ever paid in respect of a M&A transaction, bulked up by a long-drawn out process involving multiple competition filings, litigation and shareholder disagreements.

The acquirer AB InBev is expected to pay an amount “not exceeding $185m for legal advice” – dwarfing 2015’s largest M&A fees of £69.8m on the Rexam and Ball merger.

The SABMiller and AB InBev scheme document goes on to say that a proportion of the amount is conditional on the deal being completed.

AB InBev was advised by a number of firms, with Freshfields leading from London. Partners Simon Marchant and Mark Rawlinson have been heading up the efforts by the magic circle firm, although Rawlinson is soon set to leave the firm for Morgan Stanley.

Sullivan & Cromwell will also pick up a proportion of the $185m after corporate partners Frances Aquila and Krishna Veeraraghavan provided US advice from New York.

They have been working alongside London partner George White, while partners Ronald Creamer and Richard Pepperman have been advising on tax and regulatory matters respectively in New York.

A further US firm is set to benefit from AB InBev work, with partners Eric Schiele and Jonathan Davis advising alongside Scott Barshay before he left for Paul Weiss Rifkind Wharton & Garrison.

Cravath partners Christine Varney and Yonatan Even worked on antitrust matters, while partners Lauren Angelilli and Christopher Fargo led on issues tax. Finance work was handled by partners Stephen Kessing and Joseph Zavaglia, with the team also including IP partner David Kappos.

The target SAB Miller will receive a slightly smaller legal bill of $76m after being courted by AB InBev for over a year. The vast proportion of fees will be paid to Linklaters, which worked with SABMiller’s longstanding advisers Hogan Lovells.

Partners Nick Rumbsy and Charlie Jacobs led Linklaters’ efforts, while Andrew Pearson headed up Hogan Lovells’ team.

The fees also relate to the various divestments that have been completed around the world to ensure AB InBev complied with competition requirements. These include SABMiller’s $12bn (£7bn) divestment in the MillerCoors joint venture last November, as well as Asahi’s purchase of AB InBev’s Peroni, Grolsch and Meantime businesses.

Allen & Overy took the lead role for Asahi in the deal and also won the mandate advising AB InBev’s core relationship banks on the SABMiller purchase. The magic circle team was led by London partner Nicholas Clark and counsel Frederic Demeulenaere, with assistance from London corporate partner Richard Hough and Belgian partners Filip Tanghe and Dirk Meeus.

Clliford Chance, Macfarlanes and Herbert Smith Freehills will finally all pick up a proportion of fees, after advising key shareholders for both sides.

Macfarlanes won a new client in the Altria Group (SABMiller’s largest shareholder) and HSF is advising second shareholder BevCo.

The transaction, set to be the largest ever takeover of a London-listed company, is expected to lead to a massive overhaul of the companies’ existing in-house functions. SABMiller general counsel will stand down in six months following a management overhaul as a result of the takeover.