Updated

A West Virginia homeless man has been sentenced to the maximum 40 years in prison for attacking another homeless man with a machete and throwing his body into a river.

Media outlets reports 23-year-old Brian Dakota Thompson of Charleston was sentenced Wednesday in Kanawha (kuh-NAW) County Circuit Court for second-degree murder.

The body of 19-year-old Brandon Robinson was pulled from the Kanawha River in January. Both men lived on the river bank.

According to police, Robinson threw snowballs at a tent that Thompson shared with a woman. When Thompson left the tent, Robinson hit him in the head with a tree branch. Thompson then repeatedly hit Robinson with a machete and stomped on his head.

Prosecutors say an autopsy showed Robinson likely was still alive when he was thrown into the river.