While President Obama has insisted that no American ground troops join in the Libyan campaign, small groups of C.I.A. operatives have been working in Libya for several weeks and are part of a shadow force of Westerners that the Obama administration hopes can help set back Colonel Qaddafi's military, the officials said.

The C.I.A. presence comprises an unknown number of American officers who had worked at the spy agency's station in Tripoli and those who arrived more recently. In addition, current and former British officials said, dozens of British special forces and MI6 intelligence officers are working inside Libya. The British operatives have been directing airstrikes from British Tornado jets and gathering intelligence about the whereabouts of Libyan government tank columns, artillery pieces, and missile installations, the officials said.

By meeting with rebel groups, the Americans hope to fill in gaps in understanding who the leaders are of the groups opposed Colonel Qaddafi, and what their allegiances are, according to United States government officials speaking only on condition of anonymity because the actions of C.I.A. operatives are classified. The C.I.A. has declined to comment. 

The United States and its allies in the NATO-led military intervention have scrambled over the last several weeks to gather detailed information on the location and abilities of Libyan infantry and armored forces, intelligence that normally takes months of painstaking analysis.

"We didn't have great data," Gen. Carter F. Ham, who handed over control of the Libya mission to NATO on Wednesday, said in an e-mail earlier this week.   "Libya hasn't been a country we focused on a lot over past few years," he said.

American officials cautioned that the Western operatives are not working in close coordination with the rebel force, and there was little evidence on Wednesday that allied airstrikes were being used to cover the rebel retreat.

Because the publicly stated goal of the Libyan campaign is not to overthrow Colonel Qaddafi's government, the clandestine effort now going on is significantly different from the Afghan campaign to drive the Taliban from power in 2001. Back then, American C.I.A. and Special Forces troops armed a collection of Afghan militias and called in airstrikes that paved the rebel advances on strategically important cities like Kabul and Kandahar. 

Still, the American officials hope that information gathered by intelligence officers in Libya — from the location of Colonel Qaddafi's munitions depots to the clusters of government troops inside Libyan towns — might help weaken Libya's military enough to encourage defections within its ranks.

The American military is also monitoring Libyan troops with U-2 spy planes and a high-altitude Global Hawk drone, as well as a special aircraft, JSTARS, that tracks the movements of large groups of troops.  Military officials said that the Air Force also has Predator drones, similar to those now operating in Afghanistan, in reserve.

Over the weekend, the United States also began flying AC-130 gunships, which attacked Libyan tanks and armored vehicles on the coastal road near Brega and Surt with 40-millimeter and 105-millimeter cannons, an American military officer said Wednesday.

Ravi Somaiya contributed reporting from London.