The Mexican government has confirmed that a homeless Boston man police say was beaten by two brothers, one of whom said he was inspired by Donald Trump's views on immigrants, was a citizen of Mexico.

The brothers urinated on the 58-year-old man, punched him and beat him with a metal pole while he slept near a train station, and one of them said afterward that Trump was right about deporting "all these illegals," police said.

Daniel Hernandez Joseph, the consul general of Mexico in Boston, condemned the attack, saying his government would "take the necessary measures to defend the rights and interests of Mexicans," The Boston Globe reported.

The brothers, Scott and Steve Leader, were being held without bail on charges including assault and indecent exposure. They pleaded not guilty.

Witnesses flagged down a state trooper at about 12:30 a.m. Wednesday after they saw the attack and then saw the Leaders walk away laughing, prosecutors said. The victim was treated for a broken nose, serious bruises and other injuries.

'Donald Trump was right'

Scott Leader told troopers after his arrest, "Donald Trump was right, all these illegals need to be deported," according to a state police report filed in court.

Trump, a Republican presidential candidate, has inflamed Latinos by describing Mexican immigrants as "criminals" and "rapists" and saying he would build a wall between the United States and Mexico to crack down on illegal immigration.

He recently said he would deport the millions of people already in the United States illegally, sort them into groups of "good ones" and "bad ones" and then allow those deemed good to re-enter the country.

Asked about the homeless man's beating before a New Hampshire town hall on Wednesday night, he said he hadn't heard about it.

"I think that would be a shame," he said.

Attorneys who appeared with the brothers for their arraignment couldn't immediately be reached for comment.

Mexican officials said they would follow the investigation "very closely" to ensure that those responsible are held accountable.

Court records show Scott Leader served a year in prison for a hate crime against a Moroccan coffee shop worker after the Sept. 11, 2001, terror attacks, the Globe said.