He was previously the defence minister in the government of Ali Zeidan. He resigned as on 11 August 2015, over a year into the Second Libyan Civil War, saying his "exit is the solution." He left office on 12 March 2016. In April 2014, al-Thani negotiated the reopening of two out of four oil ports seized by rebels.
Also, after he threatened to resign, the Congress officially confirmed him as prime minister in a permanent capacity and vested him with greater powers to deal with Libya's problems. However, al-Thani submitted his resignation as prime minister on 13 April 2014, although he was asked to stay on as a caretaker until the election of a successor. Ahmed Maiteeq was eventually elected as the new prime minister, but Maiteeq's election was voided on 9 June and al-Thani was reinstated as caretaker.
After the election of a Council of Deputies to govern Libya, al-Thani attended the opening ceremony of the new parliament in Tobruk on 4 August 2014. The next week, however, the Tobruk-based lawmakers reappointed al-Thani as prime minister and tasked him with forming a "crisis government". In March 2015, following the start of a military intervention in support of the internationally recognised government in Yemen, al-Thani compared the situation in his country to the situation in Yemen and said Libya would call on the Arab League to "restore legitimacy".
On 26 May 2015 he survived an assassination attempt when gunmen fired on his convoy in Tobruk.