The White House has sought to dispel concerns that the fatal shooting of an Indian engineer and the wounding of two other men was inspired by President Donald Trump's rhetoric.

Addressing the killing that occurred in the US state of Kansas this week, Sean Spicer, the White House spokesperson, said on Friday any loss of life is tragic but it would be absurd to link the action to Trump's stance on immigrants.

Spicer said it was too early to guess the motive for the incident, in which a man opened fire in a crowded bar in an apparently racially motivated attack.

The assailant, who witnesses said had shouted: "Get out of my country" before he opened fire, has been charged with murder.

READ MORE: Mapping hate - The rise of hate groups in the US

Srinivas Kuchibhotla, 32, died at a hospital while Alok Madasani, 32, and Ian Grillot, 24, were in a stable condition after the attack on Wednesday night in Olathe, Kansas.

Barman Garret Bohnen told the Kansas City Star newspaper that Kuchibhotla and Madasani stopped at the bar for a drink once or twice a week.

"From what I understand, when he [the gunman] was throwing racial slurs at the two gentlemen, Ian stood up for them," Bohnen said.

Adam Purinton, the suspect, was taken into custody on Thursday and later charged, authorities said.

Asked if the shooting could be a hate crime, Eric Jackson, FBI special agent, said it was too early to determine.

'Top-of-his-class' guy

Kuchibhotla was a software engineer at Rockwell Collins, an avionics and information technology company, Rod Larson, his line manager, told the newspaper.

"He was very sharp, a top-of-his-class kind of guy," Larson said.

"His personality was exceptional. He was the kind of employee every manager would want. I couldn't say anything slightly bad about Srinivas."

Sushma Swaraj, India's foreign minister, said on Twitter "I am shocked", adding that she would help the family to bring Kuchibhotla's body back to Hyderabad.

Vikas Swarup, spokesperson for India's foreign ministry, said Kuchibhotla was from Telangana state.

.@USAndIndia strongly condemns the tragic shooting of two Indians and one American in Kansas.Our deepest sympathies. https://t.co/wGjUv35iIJ — MaryKay Loss Carlson (@USAmbIndia) February 24, 2017

Grillot said in an interview from his hospital bed that when the shooting broke out, he hid until nine shots had been fired and he thought the suspect's gun magazine was empty.

"I got up and proceeded to chase him down, try to subdue him," Grillot said in a video posted on the Kansas City Star's website. "I got behind him and he turned around and fired a round at me."

Grillot said the bullet went through his hand and into his chest, just missing a major artery.

"It's not about where he [the victim] was from or his ethnicity," Grillot said. "We're all humans, so I just did what was right to do."

US Senator Jerry Moran of Kansas posted a statement on Facebook about the shooting, expressing concern for the safety of other immigrants.

"I strongly condemn violence of any kind, especially if it is motivated by prejudice and xenophobia," Moran said.

Fund-raising drive

A GoFundMe page has been set up to collect money to fly Kuchibhotla's body to India.

The page has crossed its original $150,000 goal, raising nearly $200,000 in eight hours.

The US embassy in New Delhi condemned the shooting.

"The United States is a nation of immigrants and welcomes people from across the world to visit, work, study, and live," MaryKay Carlson, US charge d'affaires, said in a statement.

READ MORE: US anti-fascists - 'We can make racists afraid again'

"US authorities will investigate thoroughly and prosecute the case, though we recognise that justice is small consolation to families in grief."

Hate crimes against Muslims in the US shot up 67 percent in 2015 to their highest levels since the aftermath of the September 11, 2001 attacks, according to FBI statistics released in 2016.

Overall, 57 percent of the 5,850 reported incidents were motivated by race or ethnicity, while 20 percent were related to religion.