After Derna's catastrophic floods, eastern Libyan military leader Khalifa Haftar flew in by helicopter and received salutes from his troops as he toured the city where thousands of people were killed when whole districts were swept away.

Three days later, residents vented their anger on the mud-caked streets, torching the mayor's house as they accused the authorities of failing to maintain the dams that protected the city, and failing to evacuate residents before a powerful storm.

While the protesters did not take aim at Haftar - much of their anger was focused on the mayor - their demands for accountability and transparency in how aid is spent posed a challenge to authorities in the region he controls.

With his Libyan National Army (LNA) holding all of eastern Libya including Derna, the disaster looks set to give Haftar control over aid and reconstruction efforts from both the oil-rich government in Tripoli in the west and from abroad.

But it also leaves him grappling with a rare display of public dissent which could test the image he has projected to Libyans and foreign governments that he is the strongman who can save the divided nation from conflict and chaos.

The disaster was caused by the collapse of two dams during a storm on the night of Sept. 10 that unleashed a deadly torrent.

Neither the internationally recognised government in Tripoli nor eastern authorities that had controlled Derna since the LNA ousted jihadists in 2019 had repaired long-known weaknesses in the dams or evacuated people before the expected major storm.

After the mayor's house was torched by protesters, the Haftar-allied government in the east announced it had sacked him along with the rest of the municipal council.

Any further dissent risks becoming "a political problem for Haftar, who seeks to market his ability to maintain stability as superior to the authorities in Tripoli," said Tim Eaton of the Chatham House think-tank, although he said Haftar's forces were expected to show little tolerance for any more protests.

Haftar and his allies might also "see an opportunity to build credibility and access financial resources via the national and international aid responses", he added.

Reuters could not immediately reach the LNA spokesperson for comment.

DEALING WITH SETBACKS

Haftar has been a dominant player in the eastern half of Libya, a nation that has been divided since a NATO-backed uprising toppled Muammar Gaddafi in 2011.

Both his sons are public figures, suggesting he has dynastic ambitions for his family, and he is close to Russia and the United Arab Emirates. Western envoys visit him often.

But Haftar has faced setbacks, In the 1980s, Libyan army forces he commanded were defeated in Chad, and when his LNA and allies launched an offensive on Tripoli in 2019, with the backing of Russia, Egypt and the UAE, it stalled even before Turkey openly backed his opponents.

His presidential ambitions were never put to the test after a planned national vote in 2021 was cancelled over disputes about the rules, although few people had expected him to win because of the challenge of building support in the west following his attack on Tripoli.

With both military and political routes to national power cut off, Haftar has consolidated his position in eastern Libya, pushing his sons Khaled, Elseddik and Saddam into public roles.

Saddam has appeared in Derna as a member of an emergency committee, while the Tariq bin Ziyad brigade he commands in the LNA has been visible in relief efforts.

Although Elseddik does not hold any official post, he was in Europe when the Derna disaster struck, meeting Western officials, politicians and journalists and presenting himself - with his father's personal ambitions in abeyance - as a future presidential candidate.

In the hours after the disaster, Haftar said the flood-hit area was suffering "difficult and painful moments" caused by unprecedented rainfall. Sitting at a large desk in uniform, he said he had issued orders for necessary support to be provided.

The Derna disaster could play a role in Haftar's efforts to maintain the funding needed to finance the LNA and the foreign backing that could help him politically in the future.

Libya's large oil income stems from fields in areas controlled by Haftar's forces but revenues are paid into the Central Bank in Tripoli over which he has no sway.

Forces aligned with Haftar have periodically shut off oil exports to ensure Central Bank funds continue to flow east. Through the conflict the bank has paid state salaries, including of fighters, across front lines.

State spending in Libya has since 2011 often been seen by forces on the ground as an opportunity to gain access to money.

Libyans would watch closely to see how aid is spent, Eaton said. "They will take a dim view if the money disappears into leaders’ pockets as has too often been the case."

(Writing by Angus McDowall and Tom Perry; Editing by Edmund Blair)