Libyan diplomats are urging caution over an evolving U.S. plan to arm and train the country’s militias again to battle the growing Islamic State threat, fearing a repeat of the abysmal Pentagon-led program that ended with only a few hundred trained fighters and U.S. weapons in the hands of Islamist militias in Libya.

Defense Department officials shuttered the military’s initial program to train and equip moderate rebel forces in Libya late last year after only 180 rebels successfully completed the program, at a cost of millions of dollars to U.S. taxpayers.

In the months after the closure of the Pentagon-led effort, the situation on the ground in Libya has grown only more complex. As the country’s various armed factions battle for control of the country, Islamist groups such as the Islamic State and Ansar al-Shariah, al Qaeda’s main faction in Libya, are taking advantage of the internal chaos.

With memories of the last U.S. attempt to raise a rebel army to battle the Islamists still fresh, members of Libya’s nascent Government of National Accord are urging caution and patience on the part of the Pentagon, where momentum to restart the train-and-equip program is again gaining traction.

“We have to be cautious. We cannot rush back into this,” Wafa Bugaighis, charge d’affaires at the Embassy of Libya, said during a panel discussion in Washington last week on the rise of the Islamic State group, also known by the acronyms ISIS or ISIL.*

Jonathan Winer, the State Department’s special envoy for Libya, warned that the main goal for any U.S. or internationally led effort to train and arm Libya’s militias must be driven by the idea of bringing stability to the country. The concern, he said, is that regional participants in the U.S.-led program may try to press their own agendas for Libya and use the train-and-equip effort as a means to do so.

“Libya can’t afford to be divided up by people with their own regional interests [in mind]. I think everyone understands that,” Mr. Winer said at the same panel talk.

“Libya overall can be very fractious,” especially since the fall of strongman Moammar Gadhafi in 2011, he said.

U.S. troops are back on the ground in Libya, purportedly setting the stage for a long-term military training mission that Gen. Joseph Dunford, chairman of the Joint Chiefs of Staff, says could receive the green light within days.

A small number of U.S. special operations teams have been spotted on the ground in northeast and western Libya for the better part of a year, conducting patrols and advising local militias as part of the U.S.-led campaign against the Islamic State.

U.S. forces have been rotating since last year in and out of two main bases in the country’s northeastern coastal cities — one around Misrata and the other near Benghazi slightly to the west, according to recent reports.

News of American deployments to the war-torn North African country emerged as the U.S. and its European allies acknowledged that they have begun shipping weapons and other equipment to Libya’s fragile Government of National Accord to battle the jihadi threat despite U.N. sanctions.

On Thursday, Gen. Dunford told reporters that a deal between the U.S. and Tripoli to open the door to American military trainers in the country is days from being ratified.

“There’s a lot of activity going on underneath the surface. We’re just not ready to deploy capabilities yet because there hasn’t been an agreement. And frankly, any day that could happen,” Gen. Dunford told reporters after a meeting with several NATO military leaders in Brussels.

Gen. David Rodriguez, the U.S. Africa Command chief, also has met repeatedly with Government of National Accord members in Tripoli to discuss where U.S. forces could provide on-the-ground support against Islamic State strongholds, particularly the group’s base in Sirte.

Boots on the ground

Libya had the basic building blocks of a viable, unified military force before rebels ousted and eventually killed Gadhafi in the wake of the 2011 Arab Spring, Ms. Bugaighis said.

“The military institution existed” in Libya under Ghadafi, “and we think we have the nucleus of a [viable] military now,” she said.

The fatal flaw of the U.S. training program, Ms. Bugaighis said, was U.S. and allied advisers’ focus on vetting militia groups rather than building on the nucleus of what remained of Gadhafi’s military.

The lack of a viable Libyan institution to help U.S. and foreign forces vet candidates for the military training program also contributed to the program’s failure, Ms. Bugaighis said.

Libyan officials had nowhere to relay their vast knowledge of the country’s ethnic, sectarian and tribal cleavages, which would have been critical to selecting moderate militias for the program, she said.

But with the establishment of forces loyal to the Government of National Accord, based near Tripoli and western Libya, as well as militias fighting under the Libyan National Army in the eastern portion of the country, the new U.S. trainers and Western weaponry should be focused on “assisting what we have [in place] already.”

Ms. Bugaighis indicated that the decision not to leverage the forces at hand in Libya, particularly those who served under Gadhafi, was akin to another recent postwar American mistake in the Middle East — this time in Iraq. The U.S. decided after the invasion that overthrew Saddam Hussein to exclude all members of the Iraqi military and Baath Party, which helped fuel the rise of the Sunni insurgency that plagued the American occupation.

The Pentagon is still awaiting assurances from Tripoli that it can unify the country’s factions before pressing ahead with additional troop deployments to the country.

Any discussion of potential troop numbers or types of weaponry en route to Libya is premature, Capt. Davis said, in part because “this [training] mission is not yet defined because the [Libyan] government is not defined.”

Chance passed?

But with an estimated 6,000 Islamic State fighters in Libya, time may be running out for a unity government to materialize amid the violence and bloodshed.

U.S. intelligence officials say the Islamic State’s “Libya province” has emerged as the biggest and most powerful of its affiliates. U.S. officials have said privately that the number of foreign fighters traveling to join the Libya province was surging.

“There has been a pretty big uptick,” the officials told The Washington Times earlier this year. Analysts believe Islamic State leader Abu Bakr al-Baghdadi is bent on expanding his group’s footprint in Libya as its hold on Syria and Iraq has come under increasing strain.

A recent report by Human Rights Watch documented in detail the vicious rule that the Islamic State has imposed in Sirte.

“Sirte residents described scenes of horror — public beheadings, corpses in orange jumpsuits hanging from scaffolding in what they referred to as ‘crucifixions’ and masked fighters snatching men from their beds in the night,” the human rights group said.

Residents also described how operatives with the group have fined and flogged men for “smoking, listening to music or failing to ensure their wives and sisters were covered in loose black abayas,” and have hauled “boys and men into mosques for prayer and religion classes.”

As a result, the Italian government in February gave the Pentagon the green light to begin armed drone strikes against Islamic State targets in Libya and elsewhere in North Africa from U.S. and NATO bases in southern Italy. A U.S. airstrike in the eastern city of Derna in November reportedly killed Abu Nabil, the group’s top commander in Libya.

Earlier this month, Gen. Dunford told reporters that the situation in Libya had deteriorated to the point where Washington and the international community had little choice but to offer to take action.

“They want assistance [and] you know that a number of countries, including the United States are prepared to do that,” the four-star general said at the time.

• Guy Taylor contributed to this report.

*The original version of this story incorrectly stated that the Libyan charge d’affaires drew parallels between the Libyan training mission and the mission to train rebel forces in Syria. The article has been updated to reflect Ms. Bugaighis’ arguments more accurately.