BENGHAZI, Libya — Libyan forces loyal to a powerful general on Sunday recaptured two key oil terminals from militias in a surprise attack, according to officials familiar with the operation, a move that adds a new layer to the turmoil gripping the North African nation since 2011.

They said forces led by Gen. Khalifa Hifter, who heads the Libyan National Army, took over the Ras Lanuf and al-Sidra terminals on Libya’s Mediterranean coast and were battling militias at a third terminal, al-Zueitina.

The majority of Libya’s oil exports went through the three terminals before a militia known as the Petroleum Facilities Guards seized them more than two years ago.

“Zero hour has arrived, so march forward like wolves and charge like lions,” Hifter told his forces as they prepared for Sunday’s dawn attack. In a radio message, he urged the troops not to harm civilians or damage the facilities.

The militia driven out of the facilities is allied with the recently-formed, U.N.-backed government headquartered in the capital, Tripoli. That government does not recognize Hifter as commander of the national army.

The Petroleum Facilities Guards’ leader, Ibrahim Jedran, struck a deal in July with the U.N. envoy to Libya, Martin Kobler. The details of that pact were never disclosed, but critics have speculated that it involved billions of dollars, sparking charges that Kobler and the United Nations were empowering the warlord viewed by many as having held Libya’s oil hostage.

The officials said there were no casualties among the attacking forces and that the militiamen at the three facilities did not offer much resistance.

The attack took place on the eve of a major Muslim holiday, Eid al-Adha, which begins on Monday.

“Many of them (militiamen) abandoned their weapons to escape or turned themselves in,” said Brig. Gen. Ahmed al-Mosmary, a spokesman for Hifter’s forces. “We will continue to move till we secure the whole area.”

Hifter’s forces also moved against two areas in the eastern city of Benghazi that remain under militia control. Al-Mosmary said there was also little confrontation from the militiamen there, but that land mines were slowing down the advancing troops.

Hifter enjoys the support of several Arab nations, including Egypt, the United Arab Emirates and Jordan, as well as others in the West, but he is also viewed by many as an obstacle to peace. He is allied with the parliament based in eastern Libya, which refuses to recognize the U.N.-backed government in Tripoli. He is widely viewed as the savior of Libya’s eastern region, which had long suffered from marginalization under the rule of longtime dictator Moammar Gadhafi.

Libya has been split between rival parliaments and governments, each backed by a loose array of militias and tribes. Western nations view the U.N.-brokered government as the best hope for uniting the country.

If the terminals are operational again and oil exports resume, the revenues, together with a continuing political impasse, could provide the eastern region with a strong temptation to declare self-rule.