Mexican federal police shot and wounded two CIA operatives last week, security sources said, in an apparently deliberate attack that could hurt U.S.-Mexico cooperation in their war against drug cartels.

The two experienced officers were just south of the capital on their way to a Mexican Marine base on Friday, working with local authorities on a training mission, when federal police riddled their armored van bearing diplomatic plates with bullets.

The men, traveling with a Mexican Marine captain, were wounded and taken to a hospital for treatment, though their injuries were not life-threatening. Their vehicle's tires and rear windshield were shot out.

A dozen federal police officers detained and questioned over the attack have been ordered held in custody for 40 days. In initial statements to federal prosecutors, they claimed they confused the Americans for criminals.

However, witnesses who saw the shooting at a bend in the road outside the small town of Tres Marias told Reuters the gunmen were dressed in plain clothes and pursued the Americans firing from unmarked cars and on foot -- a classic style of gangland hits in Mexico.

"We had no idea at all they were police. They looked like criminals," said one woman who witnessed the incident but asked not to be named for fear of repercussions.

A Mexican government official, speaking on condition of anonymity, said the evidence suggested gang members and corrupt police had carried out the attack before other police arrived at the scene and prevented the men being killed.

"This was not an accident," the official said.

Witnesses said the CIA driver made impressive evasive maneuvers which likely saved the lives of those inside the car, and they believe they heard hundreds of bullets fired, estimating the incident lasted around six minutes.

The Mexican official said the vehicle was chased for about 4 km (2.5 miles) before it was halted, and that shell casings from AK-47s, which are not used by Mexican police and are a weapon of choice for drug cartel members, were found at the scene.

A total of four vehicles were involved in the incident, though only the shot-up van was found at the scene, the official added. One of the vehicles identified by eyewitnesses has been linked to other crimes, the official said.

Tres Marias is close to the city of Cuernavaca, a popular weekend retreat for Mexico City residents that has been badly hit by drug violence in recent years. In 2009, Mexican Marines shot dead leading cartel boss Arturo Beltran Leyva, alias "The Beard," in Cuernavaca in an operation based on information from the U.S. Drug Enforcement Administration.

His brother and fellow drug boss, Hector Beltran Leyva, is thought by some security experts to be at large nearby.

The Mexican official said the rise in criminal activity in the area was very likely being abetted by corrupt police.

"The police here have been heavily infiltrated by organized crime," said a local man, who declined to be identified.

American and Mexican officials are still investigating the incident and Mexican Attorney General Marisela Morales said on Wednesday that an ambush was one possible explanation.

U.S. officials in diplomatic vehicles went over the scene of the shooting on Wednesday, taking fresh evidence under the protection of Mexican Marines.

A separate Mexican official close to the investigation who asked not to be identified said the CIA officers were within a few miles of the Marine base when they were shot at.

The CIA declined to comment on the incident.

One U.S. official familiar with inquiries into the incident said there are a "whole lot of unanswered questions" and that dealings between the United States and Mexico could be seriously affected if Washington concludes a major cover-up is going on.

DELIBERATE AMBUSH?

Mexico's police have been plagued by corruption and officers working for hire for cartels in recent years, amid a surge in violence that poses a major challenge for incoming President Enrique Pena Nieto, who is due to take office in December.

Roadside shootings have been a feature of the violence that has overshadowed President Felipe Calderon's six years in office. Gangs have been known to set up fake military checkpoints to ambush rivals.

Last year, two U.S. Immigration and Customs Enforcement agents were shot by hitmen on a major Mexican highway. One of the agents died.

Calderon promised on Tuesday to get to the bottom of how the two CIA officers were shot. Speaking alongside the U.S. ambassador in Mexico, Calderon said the incident should not hinder bilateral efforts to fight Mexico's violent drug cartels.

"We can't allow these things to happen, whether it is because of negligence, lack of training, lack of trust or complicity," Calderon said.

The CIA, FBI and Drug Enforcement Administration have officers operating out of the U.S. embassy in Mexico City.

Under the "Merida Initiative" which began in 2008, U.S. operatives have trained Mexican police and soldiers to help them fight the cartels. Washington has also supplied equipment including Black Hawk helicopters and surveillance gear.

Much of the training and hardware has gone to the Marines, an elite force inside Mexico's Navy Ministry that has captured or killed several major drug traffickers. However, the United States has also trained the federal police.

During Calderon's six-year offensive against cartels, there have been more than 55,000 drug-related murders. More than 3,000 police and soldiers have died, although many were involved with the gangs.