MEXICO CITY (AP) — Police in the northern Mexico border state of Coahuila shot a Salvadoran migrant accused of drawing a pistol and opening fire on officers, prosecutors said Thursday.

A migrant shelter in the Coahuila city of Saltillo said the Salvadoran man had been waiting with other migrants late Wednesday to hop a freight train to the U.S. border.

The Casa Del Migrante Saltillo shelter said the group of about 10 migrants had stayed at the shelter before heading to the train tracks, and suggested they were victims of an overzealous raid by state and federal forces.

The shelter said in a statement the migrants hid a 2-year-old girl who was separated from her mother during the raid because "they assumed the agents of the Coahuila prosecutors' office were shooting to kill." It also said the victim was traveling with his 8-year-old daughter who saw him shot.

But the prosecutor's office gave a different story.

"At the train tracks, four men verbally attacked police, and one of them took out a firearm and fired shots, while other people fled on foot," the office said in a statement. "The officers returned fire and thus the attacker fell dead."

The federal government issued a statement Thursday saying neither federal police nor immigration agents were involved in the raid Wednesday.

The Coahuila state government said in a separate statement that the man's death was under investigation. It said the girl was safe and in the custody of child welfare officials.

While Central American migrants have scuffled in the past with Mexican police, especially at the southern border, there haven't been any armed confrontations in recent years.

The human rights advocacy group Amnesty International condemned the shooting and called for a thorough investigation. It noted that the shelter where the group stayed checks migrants and their possessions for weapons before allowing them in.

Hopping freight trains is technically illegal but common among migrants in Mexico. In the past, migrants have complained of being attacked by private rail security employees.

In recent months, the Mexican government has cracked down on migrants crossing the country to reach the U.S. border, raiding hotels, buses and freight trains.

The Saltillo shelter had issued a public complaint last week after military and police vehicles pulled up outside the shelter. Shelter operators feared police were trying to detain migrants inside, while police said they were just responding to citizen complaints in the area.