His arrest followed his refusal to honour invitations of a panel the president set up to probe the EFCC under his watch.
The panel headed by Ayo Salami, a former president of the Court of Appeal, had indicted Magu of corruption and recommended his sack.
Buhari eventually appointed Abdulrasheed Bawa as chairman of the anti-graft agency.
In a statement, Ubani said he was illegally detained for 23 days on the orders of Magu.
He said his travails started after he accepted to be the counsel of Ngozi Olejeme, a former chairman of the Nigeria Social Insurance Trust Fund (NSITF), who was accused of criminal conspiracy, abuse of office, diversion of public funds and money laundering to the tune of N69 billion.
N6 4bn NSITF fraud: Ubani withdraws suretyship of Olejeme, blasts Magu
dailypost.ng - get the latest breaking news, showbiz & celebrity photos, sport news & rumours, viral videos and top stories from dailypost.ng Daily Mail and Mail on Sunday newspapers.
Lawyer: I asked God to disgrace Magu out of office after he illegally detained me
thecable.ng - get the latest breaking news, showbiz & celebrity photos, sport news & rumours, viral videos and top stories from thecable.ng Daily Mail and Mail on Sunday newspapers.