MEXICO CITY — Gunmen who shot up an SUV carrying two U.S. Immigration and Customs Enforcement agents, killing one, knew they were attacking law enforcement officers, according to U.S. officials.

But details of the attack that emerged Wednesday indicate the two agents were not targeted ahead of time, rather stopped in the wrong place at the wrong time in a blue Suburban – a vehicle coveted by drug cartels.

Special Agent Jaime Zapata, 32, died and a second agent, Victor Avila, was wounded Tuesday when they were attacked after being stopped on a four-lane federal highway in northern Mexico.

They were returning to Mexico City from a meeting with other U.S. personnel in the state of San Luis Potosi, according to an ICE statement, which also said the Mexican government does not authorize U.S. law enforcement personnel to carry weapons.

Some reports said the two were stopped at a roadblock, while others said they were run off the road by other vehicles.

Texas Congressman Michael McCaul, who was briefed on the incident as chairman of the Homeland Security Oversight and Investigations Subcommittee, the gunmen opened fire after the agents identified themselves as U.S. diplomats.

An U.S. law enforcement official told The Associated Press that the gunmen made comments before they fired indicating they knew who their targets were. The official was not authorized to discuss the case publicly.

"This was an intentional ambush against two United States federal agents," McCaul said in a statement. "This tragic event is a game changer. The United States will not tolerate acts of violence against its citizens or law enforcement and I believe we must respond forcefully."

U.S. Homeland Security Secretary Janet Napolitano and Attorney General Eric Holder announced a joint task force led by the FBI to help Mexico find the killers.

The State Department also expressed confidence in the ability of President Felipe Calderon's government to pursue the case.

"The Calderon government has stepped forward very courageously in recent years. They are, with the United States' help, taking aggressive action against the perpetrators of this kind of violence," State Department spokesman P.J. Crowley told reporters in Washington.

Zapata and Avila, both assigned to the ICE attache office in Mexico City, were attacked in an area where violence is on the rise from drug cartels fighting for territory. Avila was shot twice in the leg and has been discharged from the hospital, according to an ICE statement Wednesday.

Al Pena, a senior ICE official until he retired in December, said the agents arranged to meet Monterrey-based ICE agents midway between Mexico City and Monterrey to pick up equipment. They were returning south to Mexico City when attacked. He didn't know what equipment the ICE agents exchanged.

Pena, who was the Homeland Security attache in Mexico City in 2008 and 2009, said the ICE office in Mexico works on many issues – from training customs investigators to investigating drug and human trafficking, gun running and money laundering.

Avila "was working on many, many issues," said Pena, who knows him well. "There's not much specialization when you have an office that small."

San Luis Potosi Gov. Fernando Toranzo told W Radio in Mexico that he has seen a dramatic rise in organized crime in his state, which borders two northern states where the Gulf and Zetas cartels have waged bloody battles over territory.

"It's had a major impact that we hadn't see before," Toranzo said. "Right now we're waging a direct fight with all our state resources to restore order."

Since Calderon launched a crackdown on organized crime shortly after assuming the presidency in December 2006, almost 35,000 people have been killed in drug-related violence.

Zapata was on temporary assignment to Mexico from the Laredo, Texas office. He joined Homeland Security in 2006, served on the Human Smuggling and Trafficking Unit as well as the Border Enforcement Security Task Force. He also was a member of the U.S. Border Patrol in Yuma, Arizona.

Though Mexico is seeing record rates of violence, it is rare for U.S. officials to be attacked. The U.S. government, however, has become increasingly concerned about the safety of its employees in the country.

In March, a U.S. employee of the American consulate in Ciudad Juarez, her husband and a Mexican tied to the consulate were killed when drug gang members fired on their cars after they left a children's party in the city across from El Paso, Texas.

The U.S. State Department has taken several measures over the past year to protect consulate employees and their families. It has at times authorized the departure of relatives of U.S. government employees in northern Mexican cities.

In July, it temporarily closed the consulate in Ciudad Juarez after receiving unspecified threats. Earlier this month, the consulate in Guadalajara prohibited U.S. government officials from traveling after dark on the road to the airport because of cartel-related attacks in Mexico's second-largest city.