Updated

As President Donald Trump recently stood beside the Lebanese prime minister praising his government for standing up to Hezbollah, the Iranian-backed militants were busy demonstrating just how wrong he was. They were clearing the country's eastern frontier from al-Qaida fighters in a sweeping offensive and negotiating a complex prisoner deal with the group.

Far from being an ally in the fight against Hezbollah, the Lebanese government headed by Saad Hariri is based on a partnership with the Shiite group, whose clout and dominance in the tiny country is on the rise.

"Lebanon is on the front lines in the fight against (the Islamic State group), al-Qaida and Hezbollah," Trump said at the press conference in Washington, lighting up social media with comments from Lebanese who ridiculed his perceived ignorance of Lebanese politics.

Trump aside, there is much about Hezbollah's role in Lebanon that is sometimes difficult for outsiders to understand.

The Iranian proxy is the single most potent military and political force in Lebanon, with an arsenal surpassing that of the country's army. By many accounts, Hezbollah has brought disaster to the country by engaging in destructive wars with Israel, and, as Trump himself noted, it has fueled the humanitarian catastrophe in Syria where it has sent thousands of its fighters to shore up President Bashar Assad's forces.

But to its many supporters, the group is a stabilizing force in a fragile country with a historically weak central government that has been repeatedly battered by Israel and struggled against Sunni militancy, particularly since the eruption of the Syrian civil war.

The party, founded in the early 80s to fight Israeli occupation of parts of Lebanon, enjoys a support base that extends well beyond its Shiite constituency. It has been a mainstay of Lebanese politics for the past few decades, taking part in governments and offering state-within-a-state services to followers in its strongholds without trying to impose its religious views on the country's pluralist society.

The group has its own secure telecommunications network and a reach that extends across vital Lebanese installations and infrastructure, as well as veto power in the Lebanese cabinet.

Its decision to send fighters to Syria in 2013 remains highly controversial in Lebanon, but the group has to a large extent successfully portrayed its presence as a necessity to protect Lebanon from militant groups including Islamic State and al-Qaida, which proliferated in Syria and overran the border with Lebanon in 2014.

This week, the group took credit for ending the presence of al-Qaida elements in the border area, following a week-long military offensive and then a negotiated settlement that saw hundreds of al-Qaida-linked militants, their families and thousands of civilians, return to Syria. The Lebanese military, which has received more than $1 billion in U.S. security assistance in the past decade, took a back seat in the operation.

Hariri recognized Hezbollah's role — criticized by its opponents in Lebanon — saying that the end result was what mattered and calling it "a big achievement."

"We have our opinion and Hezbollah has its opinion, but in the end, we met on a consensus that concerns the Lebanese people for the (good of) the Lebanese economy, security and stability," he said.

In a clear distribution of roles, the army is now expected to spearhead an upcoming fight in another section of the border, this time against Islamic State group militants.

Declaring victory Friday night, Hezbollah leader Hassan Nasrallah said the army was perfectly capable of winning that fight but offered his support should it be needed.

"We are at the service of the Lebanese army and under its command ... if they ask for any help we will help," he said in a televised speech.

It is this complex relationship between Lebanese governments and Hezbollah that foreigners often find so baffling.

"Both Lebanon and Hezbollah occupy a grey area: Lebanon isn't really a state, and Hezbollah isn't a terrorist group — or isn't only a terrorist group, depending on your view," said Faysal Itani, a senior fellow with the Atlantic Council's Rafik Hariri Center for the Middle East, explaining the misperceptions.

"So the American tendency is either to treat Hezbollah as controlling the state of Lebanon, or to see Lebanon as a sovereign entity fighting a terrorist group. Both are false."

The Lebanese government headed by Hariri was formed in December following an extended paralysis and a presidential vacuum that lasted nearly three years. Hariri, a Sunni politician squarely opposed to Hezbollah and Assad, was made prime minister only after an overall bargain was reached with Hezbollah that included the election of Michel Aoun, a Hezbollah ally, as president.

Aoun has repeatedly said that Hezbollah's arms complement those of the Lebanese military.

Hariri, whose father, former Premier Rafik Hariri was assassinated with a ton of explosives in 2005 in a bombing some blamed on Hezbollah, has a tough balancing act to maintain. Hezbollah and its allies brought down a previous government headed by Hariri in 2011 by resigning while he was in Washington meeting the U.S. president.

During his visit to Washington, Hariri responded to questions about his uneasy coalition with Hezbollah, describing it as necessity to shield Lebanon from slipping into renewed civil war.

Following Trump's press conference, during which he described Hezbollah as a "menace to the Lebanese state" and the entire region, Nasrallah said he would not comment so as not to embarrass the Lebanese delegation headed by Hariri while it was still in Washington.

Hezbollah displayed its clout when it invited journalists on a border tour after ousting al-Qaida militants from the area, parading its fighters, armored personnel carriers and missiles on the barren mountains in surreal displays of confidence that stressed that Hezbollah, and not the U.S., was fighting terrorism.

During the offensive and on the tour, the group repeatedly stuck the yellow Hezbollah flag next to the Lebanese flag, suggesting the two cannot be separated.

Israeli officials have used such displays to emphasize that there's no line between the Lebanese state and Hezbollah, particularly with Aoun's election as president, suggesting the Lebanese state will pay heavily in any future war between Israel and Hezbollah.

Itani said Hezbollah has been infiltrating and co-opting parts of the Lebanese government for over 20 years.

"I do not see them as separate from the Lebanese government," he said.