A Sudanese teen refugee has been released from a detention center in western Libya where he was held for five months after being kidnapped and tortured by gunmen demanding ransom, his family said Wednesday.

Mazen Adam, 15, from Sudan’s conflict-torn Darfur region, walked free on Monday from a juvenile detention center near the capital, Tripoli, according to his father, Mohamed Adam.

However, Libyan authorities have not dropped charges against the boy, claiming the kidnapping was fabricated, and only released him pending investigation, his father said.

"Mazen is well but he still suffers from torture-related injuries," the father told The Associated Press.

The second of four siblings, Mazen will be checked by doctors from the U.N. refugee agency on Feb, 12 in the Libyan capital, the father also said. The family is registered with the UNHCR as Sudanese refugees in Libya.

FAMILIES KIDNAPPED FLEEING SUDAN'S DARFUR UNREST: LOCAL LEADER

Mazen's father and Libyan rights groups deny claims that the kidnapping was fabricated. A government spokesman did not answer calls seeking comment.

Mazen was kidnapped on Aug. 30 by unknown gunmen, demanding ransom in the western town of Warshafana, on the southwestern outskirts of Tripoli.

Shortly after his abduction, he appeared in a video on social media, begging for mercy as a man beat him and pointed a riffle at his face, apparently to scare him.

Trippoli skyline

Tripoli's skyline is pictured on September 1, 2011. A Sudanese teen was released from a Libyan detention center near Tripoli on Monday. (PATRICK BAZ/AFP via Getty Images)

A day later, his father was taken by armed men in uniform after he spoke publicly about his son's kidnapping. The father was released three weeks later and launched a campaign for his son’s freedom.

SUDAN SAYS 4 CHINESE WORKERS ABDUCTED IN DARFUR REGION HAVE BEEN RELEASED

It's unclear how Mazen went from being in the hands of his kidnappers to being held in juvenile detention. His father blames the local police.

"Police in Warshafana conspired with the kidnappers who tortured my son," he said, adding that the kidnappers have vanished and that the police did not pursue them.

Local rights groups joined Adam's efforts to free Mazen and called for authorities to take action.

The National Commission for Human Rights in Libya, a rights group, said Mazen was a victim of human traffickers, and appealed on Libyan prosecutors to annul accusations against him.

CLICK HERE TO GET THE FOX NEWS APP

Mazen's story and the video of his ordeal at the hands of his captors has underscored how abuse, torture, sexual violence, and killings of migrants are rampant in Libya.

The oil-rich North African country plunged into chaos following a NATO-backed uprising that toppled and killed longtime autocrat Moammar Gadhafi in 2011. In recent years, it emerged as the dominant transit point for migrants from Africa and the Middle East trying to make it to Europe.