Two Boston brothers who beat and urinated on a homeless Mexican man, then told police "Donald Trump was right: All these illegals need to be deported," were sentenced to prison on Monday.

Scott Leader, 38, and Steve Leader, 30, had previously pleaded guilty to indictments charging them with causing bodily injury while committing a civil rights violation, as well as assault and battery with a dangerous weapon, among other charges.

Scott Leader was sentenced to three years in prison and Steve Leader was sentenced to one and a half years, the Suffolk County District Attorney's Office said in a statement. The pair will also be on probation for three years after their prison sentences end.

The Leaders were arrested on August 19 on suspicion of beating Rodriguez, then 58, as he slept in a subway station. The men told police they targeted their victim because they believed he was an undocumented immigrant.

The victim, Guillermo Rodriguez, said in a statement that he was in fact a permanent resident.

"I came to this country many years ago and worked hard in the farm fields to provide produce to people here. I actually became a permanent resident of this country years ago, although if I had been undocumented I still would not have deserved to be beaten this way," Rodriguez said in a prepared statement read by Assistant District Attorney Nicole Rimar before the sentencing.

The pair punched and kicked Rodriguez, and one of the men repeatedly struck him with a metal pole, before the two walked off laughing, prosecutors said.

According to a police report, they told officers, "Donald Trump was right: All these illegals need to be deported."

Prosecutors said Scott Leader told arresting officers that he believed the attack was justified because the victim was homeless and Hispanic. The pair also allegedly threatened police officers while in custody.

Trump, the presumptive Republican nominee in the US presidential race, has been vocal on immigration, proposing to build a wall on the US-Mexico border and promising, if elected, to deport the estimated 11 million undocumented immigrants already in the United States.

Trump, a real estate developer and reality television personality, initially described the attack as an outcome of passionate views on immigration but later called it "terrible."

Lawyers for the two men could not be reached for immediate comment on Monday night.