WASHINGTON — The Pentagon and State Department are speeding up efforts to help the Libyan government create a commando force to combat Islamic extremists like the ones who killed the American ambassador in Libya last month and to help counter the country’s fractious militias, according to internal government documents.

The Obama administration quietly won Congress’s approval last month to shift about $8 million from Pentagon operations and counterterrorism aid budgeted for Pakistan to begin building an elite Libyan force over the next year that could ultimately number about 500 troops. American Special Operations forces could conduct much of the training, as they have with counterterrorism forces in Pakistan and Yemen, American officials said.

The effort to establish the new unit was already under way before the assault that killed Ambassador J. Christopher Stevens and three other Americans at the United States Mission in Benghazi, Libya. But the plan has taken on new urgency as the new government in Tripoli tries to assert control over the country’s militant factions.

According to an unclassified internal State Department memo sent to Congress on Sept. 4, the plan’s goal is to enhance “Libya’s ability to combat and defend against threats from Al Qaeda and its affiliates.” A companion Pentagon document envisions that the Libyan commando force will “counter and defeat terrorist and violent extremist organizations.” Right now, Libya has no such capability, American officials said.