Tasnim Aslam, a Pakistani foreign ministry spokeswoman,
identified the student as Amer Cheema, but would not say exactly when he was arrested.
She said an initial report from Berlin suggested that Cheema had hanged himself at a prison, and added that Pakistan was trying to get more details.
"So far, we only know that he had been detained for allegedly trying to hurt the editor of a German newspaper in Berlin, and his trial had not started yet," she told The Associated Press.
In Berlin, a spokeswoman for justice officials confirmed that a 28-year-old whose name she gave only as Aamir C was found dead in his cell early on Wednesday, having hanged himself using his clothes.
Juliane Baer-Henney said there was no indication that anyone else had been involved in the man's death.
"There were no indications of involvement of other persons," said Baer-Henney.
"He used his clothing to fashion a noose and hanged himself on the grill over his window."
The young man was being held in pre-trial confinement, she said, but declined to give immediate details of the case.
In an earlier statement, justice officials said he was being held on "suspicion of attempted coercion and resisting arrest."
According to Pakistani media reports, Mian Aslam, a politician, met with Cheema's father in Rawalpindi, a city near the capital, on Thursday and promised to raise the issue in the parliament.
On Friday, three members of parliament from Mutahida Majlis-e-Amal - a coalition of six religious parties - introduced a motion in the National Assembly, seeking a debate on the death of Cheema in his cell.
Pakistanis had held many protests
against the cartoons' publication
They said the student - according to his family - had allegedly been tortured to death, though they offered no evidence to back up the claim.
The government did not oppose the motion, and Chaudhry Ameer Hussain, the assembly speaker, allowed it to be debated at an unspecified date.
Cheema, who was studying at the University of Applied Sciences in the Bavarian city of Muenchberg since 2004, was arrested on March 20 after trying to enter the Axel Springer publishing house building in Berlin carrying a knife.
Springer is the publisher of Die Welt newspaper, which in February had re-published the controversial caricatures of the Prophet Muhammad that first appeared in September in a Danish publication.
The cartoons sparked rallies by Muslims across the world. Some protests turned violent, including in Pakistan, where at least five people died in the unrest.
The caricatures - including one that depicts the prophet with a turban shaped like a bomb with a burning fuse - were deemed blasphemous.
Islamic tradition bars the depiction of the Prophet Muhammad, favourable or otherwise, to prevent idolatry.