EL PASO, Texas, Aug 6 (Reuters) - U.S. President Donald Trump, whose rhetoric about an immigrant "invasion" has alienated many in the predominantly Hispanic city of El Paso, will visit the grieving Texas border town on Wednesday after a gun massacre that killed 22 people.

El Paso has been on the front lines of the Trump administration's campaign to staunch the flow of migrants over the U.S.-Mexican border. The President in January called it one of America's "most dangerous cities" before a wall was built.

But the city's mayor, Dee Margo, and some of its residents, reeling after Saturday's rampage at a crowded Walmart store believed to have been racially motivated against Hispanics, said they would welcome the president.

"This is not a political visit," Margo said. "He is president of the United States. So, in that capacity, I will fulfill my obligations as mayor of El Paso to meet with the president and discuss whatever our needs are in this community."

Activists who gathered for a vigil for the victims on Monday evening placed some of the blame for the bloodshed on the president.

"He's complicit in this violence and all the terror that we're seeing," said Rachel Cheek, 26.

The White House on Tuesday confirmed Trump would visit El Paso and Dayton, Ohio, where nine people were killed in another shooting on Saturday night.

Trump, in a speech on Monday, said Americans must "condemn racism, bigotry and white supremacy." He proposed tighter monitoring of the internet, mental health reform and wider use of the death penalty following the weekend shootings.

POLITICS ASIDE

James Peinado, a Latino and leader of the local chapter of the gun rights group Open Carry Texas, said he found the president's visit "extremely appropriate," though he hoped Trump might use the occasion to employ more diplomatic language while El Paso is grieving.

"Let's put politics aside because we all need to come together," Peinado said.

Former Texas congressman Beto O'Rourke, an El Paso native seeking the 2020 Democratic presidential nomination, on Monday told the president to stay away.

"This president, who helped create the hatred that made Saturday's tragedy possible, should not come to El Paso," O'Rourke said in a tweet. "We do not need more division. We need to heal. He has no place here."

Trump and O'Rourke held dueling rallies in the city of 800,000 people in February. Weeks earlier, Trump said during his State of the Union speech that El Paso had been a dangerous city before a wall was built there.

Margo, citing FBI statistics, said in response that El Paso has been one of America's safest cities for decades. The wall was built between 2008 and 2010 before Trump became president.

At the Monday vigil at Casa Carmelita, a sanctuary for migrants serving as a grieving center, people spoke of Trump's deployment of military troops to the border, the deportation of asylum-seekers and the separation of children from their families.

Some said his actions and words have encouraged white supremacists.

"Before, these things were hidden. The white supremacy. The violence against minorities," said Ana Morales, 34.

White House spokesman Hogan Gidley said on Tuesday it was "ridiculous" to blame Trump for the El Paso shooting, but he did not address criticism that the president used inflammatory rhetoric.

"It's not the politician's fault when someone acts out their evil intention," Gidley told reporters at the White House.

"Quite frankly, it's ridiculous to try and make those connect in some way. You have to blame the people here who pulled the trigger. Those are the ones who are evil, those are the ones who are sick and mentally ill and those are the ones who have to be dealt with."

LENGTHY ANTI-IMMIGRANT MANIFESTO

The suspected El Paso shooter, Patrick Crusius, 21, faces a single count of capital murder. Authorities say he opened fire with a rifle on Walmart shoppers, many of them bargain hunting for back-to-school supplies. The suspect then surrendered to officers who confronted him outside the store.

CNN, citing El Paso police, said Crusius drove nearly a half-mile away from the scene, where he surrendered to a police motorcycle officer who was securing the perimeter.

He got out of a Honda Civic, put his hands up and told the officer he was the shooter, CNN reported. The officer, having no time to call for backup, immediately handcuffed the suspect before Texas Rangers contained the scene, it said.

A Texas prosecutor said the state will seek the death penalty against Crusius if he is convicted. Federal prosecutors have called it domestic terrorism.

Crusius made an initial court appearance early on Sunday. San Antonio attorney Mark Stevens has been appointed to the case by the court, online court records showed.

Authorities have cited a lengthy anti-immigrant manifesto, apparently posted online by the suspect before the Saturday morning shooting. Eight of those killed were Mexican citizens, according to the Mexican government.

The four-page statement uploaded to 8chan, a largely unmoderated online message board often used by extremists, called the Walmart attack "a response to the Hispanic invasion of Texas."

Two South American countries - Uruguay and Venezuela - have issued warnings for its citizens to take precautions when traveling to the United States amid growing violence and hate crimes, particularly in some U.S. cities.

Several hundred classmates, teachers and relatives filled a high school football stadium in the El Paso suburb of Horizon on Monday for a memorial service to honor Javier Rodriguez, a 15-year-old with U.S.-Mexican citizenship who was the youngest victim killed in the rampage.