An Afghan migrant to Germany has been found guilty of raping and murdering a 19-year-old medical student and sentenced to life in prison in a case that fueled a debate about the country's immigration policies.

The dpa news agency reported Thursday the Freiburg regional court ruled Hussein K. represents enough of a danger he can be kept behind bars past the usual 15 years for a life term in Germany.

During his trial K., whose last name was withheld in line with privacy laws, testified he pulled Maria Ladenburger from her bicycle in October 2016, raped her and dumped her unconscious in a river, where she drowned.

K., who entered Germany in 2015, claimed he was 18 at the time of the crime. An expert report and witness statements put his age at 22