A man charged with fatally shooting an Indian immigrant last year at a suburban Kansas City bar has pleaded guilty to murder in a killing that fanned fears of anti-immigrant violence following Donald Trump’s election.

Witnesses said Adam Purinton, who is white, yelled “Get out of my country!” before firing at two men who had stopped for an after-work drink at Austin’s Bar and Grill in Olathe, Kansas.

Srinivas Kuchibhotla was killed in the 22 February 2017 attack. His friend Alok Madasani was wounded. The men, both 32, had come from India to the US as students and worked as engineers at nearby GPS-maker Garmin.

Another man, Ian Grillot, was wounded when he tried to intervene.

Purinton faces life in prison with no chance of parole for 50 years when he is sentenced on 4 May for premeditated first-degree murder.

At the time of the shooting, officials in India expressed concern about their citizens’ safety in the United States.

Kuchibhotla’s widow, who was not at the hearing, issued a statement saying she hoped the guilty plea would “send a strong message that hate is never acceptable”. “We must understand and love one another,” Sunayana Dumala said.

Purinton was asked to leave the bar when he made derogatory comments. He returned a short time later with a gun, according to court documents. Madasani told detectives that the gunman asked the men if their “status was legal” before he opened fire, an affidavit indicated.

After the shooting, Purinton drove 70 miles east to Clinton, Missouri, and stopped at a restaurant, where he confessed to the killings to a bartender, who called police.

Purinton, a 52-year-old navy veteran, was a regular customer at Austin’s. Neighbors in the Olathe cul-de-sac where he lived told the Associated Press after the shooting that he became “a drunken mess” following his father’s death about two years before the shooting and had physically and mentally deteriorated.

He still faces federal hate crime charges. Federal prosecutors have not determined whether to seek the death penalty.