The 17-year-old Afghan was arrested on Friday after his DNA was found at the scene of the crime and he was identified on CCTV, authorities in the south-west German town of Freiburg told a press conference.
Germany bans extremist group, crackdown follows
The Afghan, who has said nothing to investigators about the alleged crimes, arrived in Germany in 2015 as an unaccompanied minor and had been living with a host family.
The teenage victim was a medical student who was found dead on the banks of the river Dreisam, which Freiburg straddles, on October 16. An autopsy found that she had drowned.
The previous evening she had gone out to a student night before cycling home. Her body was found just a few hours later. No personal link has yet been found between the victim and the alleged murderer, authorities said.
The murder made big news in Germany and was followed by another as yet unsolved crime on November 10 in the nearby Endingen forest, in which a 27-year-old jogger was found dead having also been raped. So far, investigators have established no connection between the two murders.
News of the young Afghan's arrest triggered much reaction on social media with some people saying an ironic "thank you" to German Chancellor Angela Merkel.
The 62-year-old, who will next year seek a fourth term in office, has faced criticism for her previous open-door policy towards refugees, although more recently she has tried to curb the influx.
From Pakistan to Germany: A transgender woman’s search for safety and respect
Germany received 890,000 asylum requests in 2015, although that rate slowed to 213,000 from January to September 2016 following a deal between the European Union and Ankara to stem the flow of migrants crossing from Turkey into the bloc.
Public anger about the number of refugee arrivals in Germany has been stoked by some high profile crimes involving migrants.
Last month, German police arrested seven Afghan asylum seekers on suspicion of repeatedly raping an Iranian teenager in a refugee camp.
During the last New Year's Eve celebrations, hundreds of women reported sexual assaults in Cologne and other German cities, with the attacks blamed largely on Arab and North African men.
COMMENTS
Comments are moderated and generally will be posted if they are on-topic and not abusive.
For more information, please see our Comments FAQ