Marghani served at the prosecution office during the reign of
Muammar Ghaddafi. He also worked as a consultant at the law department of the ministry of justice. In November 2012, he was appointed justice minister to the cabinet headed by Prime Minister Ali Zeidan.{{cite news|work=ABO
Controversy On 31 March 2013, armed gunmen stormed ministry of justice and threw Marghani and his staff out of the building due to their objections to Marghani's statements made during an interview with Libya AhrarTV.{{cite news ==Awards==