Bodies of Salvadoran migrant Oscar Martinez Ramirez and his daughter, who drowned. (AFP)

Highlights Migrant, his daughter die while trying to cross a river from Mexico to US

The migrant's wife survives the ordeal and arrived on shore

The two bodies were found Monday in Matamoros in Tamaulipas state

Shocking images of a drowned Salvadoran migrant and his two-year-old daughter who died while trying to cross the Rio Grande river from Mexico to the United States have sparked outrage, underscoring the dangers faced by asylum-seekers.

Twenty-five-year-old Oscar Martinez Ramirez fled El Salvador with his 21-year-old wife and their daughter and decided to make the risky crossing from Mexico to the US on Sunday afternoon, according to a Mexican court report seen by AFP.

Ramirez carried the little girl on his back, stowing her inside his t-shirt to keep her safe as they attempted to cross the river. But the pair were swept away by violent currents, drowning before her mother's eyes, who survived the ordeal and arrived on shore.

The two bodies were found Monday in Matamoros in Tamaulipas state.

A series of haunting photographs showing the young father and child lying face-down in water have stirred anger in El Salvador and Mexico, where the government had faced sharp criticism for its treatment of migrants.

President Andres Manuel Lopez Obrador, a leftist who took office in December vowing to protect migrants' rights, has previously come under fire over an AFP journalist's images last week of heavily armed National Guardsmen forcibly detaining two women and a girl at the Rio Grande.

On Tuesday, the Mexican leader said the 15,000 troops his government has deployed to the US border do not have orders to stop migrants from crossing, and vowed to investigate the controversial detention.

International law protects the right of undocumented migrants to cross borders to seek asylum, and Mexico has not typically stopped them from doing so at its northern border.

But Lopez Obrador is facing pressure from US President Donald Trump on the issue, and his government is eager to show results and avoid the punitive tariffs the US leader threatened last month to impose on Mexican goods.

On June 7, the two countries reached an agreement, with Mexico agreeing to reinforce its southern border with 6,000 National Guardsmen. Washington has given Mexico 45 days to take action.