A homeless man living out of his car in Germany has been sentenced to life in prison for attempted murder after deliberately hitting a cyclist in an effort to get permanent care and shelter in jail, reports said Thursday.

The 62-year-old homeless man from Mönchengladbach drove into an oncoming bicycle lane in the northern state of Lower Saxony in June and rammed the 48-year-old cyclist at almost 50 miles per hour, according to German news outlet Nordbuzz.de.

GERMAN ACTIVISTS APOLOGIZE FOR USE OF HOLOCAUST VICTIMS' REMAINS IN ANTI-NAZI INSTALLATION

The victim was seriously injured in the attack, according to media reports.

Judges in Oldenburg handed down the high sentence after ruling that greed motivated the attack since the homeless man had wanted “all-round care in a penal institution,” the BBC reported.

MIAMI BARBERSHOP HANDS OUT FREE HAIRCUTS TO THE HOMELESS FOR CHRISTMAS

The man became homeless after losing his job as a computer scientist and squandering his savings on a trip around Europe, the outlet said.

At the time of the attack, the man had no place of residence and no income other than his pension payments, according to Spiegel Online. His only possession was his car, although the registration had expired almost two years ago, the outlet reported.

CLICK HERE FOR THE FOX NEWS APP

A court spokesman said the homeless man has since shown remorse and asked that his pension payments go to the victim, according to reports.