Matthew VanDyke, a freelance journalist from Baltimore who had been missing in Libya since March, was released from Tripoli’s notorious Abu Salim prison on Wednesday, according to his mother, whom he talked to on a borrowed Libyan cellphone.

“He sounds good,” said Sherry VanDyke, a retired Baltimore school principal, who had spent months lobbying lawmakers and human rights organizations to find information about her only child. “He sounds just like himself,” she said.

VanDyke, 32, a graduate of Georgetown University’s school of foreign service, had been in solitary confinement in the prison, able to hear news only through the walls when Libyan prisoners would call out what they had seen on a television set, his mother said.

On Wednesday, several Libyans arrived at his cell and released him, his mother said. “At first he thought they were coming to kill him,” she added.

The prison had been liberated by rebel fighters, and he was led to a compound that he told his mother was safe.

By Wednesday afternoon, “all U.S. citizens who were known to be detained in Libya have been released,” State Department spokesman Victoria Nuland said.

A State Department official said four Americans had been released Wednesday and a fifth earlier in the week, and added that U.S. officials will work with the government of Hungary, which has represented U.S. interests in Libya, to help get them out.

VanDyke had traveled to Libya in March to document the uprising. He disappeared six days after arriving, along with three Libyan friends, when forces loyal to Moammar Gaddafi took control of an oil port to which they had traveled.

What was supposed to be a day trip to the town of Brega devolved into a nightmare that stretched to almost half a year.

A mother’s quest

Since then, his mother’s life had been dedicated to finding her son. As other journalists who had disappeared in Libya around the same time were located and released within days or weeks, VanDyke’s mother had a hard time getting information about the fate of her son. Neither the State Department nor organizations such as Human Rights Watch or the Committee to Protect Journalists could give her any concrete evidence that he was even alive.

In July, a Libyan friend with whom VanDyke had been staying in Benghazi told the International Committee of the Red Cross that the American had been spotted in Abu Salim prison, a facility that gained infamy in 1996 when the Libyan government killed an estimated 1,200 prisoners there.

But until Wednesday, no one could confirm that VanDyke was in Abu Salim.

Then, around 2 p.m. on Wednesday in Baltimore, VanDyke’s girlfriend, Lauren Fischer, got a call on her cellphone. “I said hello, and it was his voice,” she said. “He said my name, and ‘Hi, where are you, I love you; I miss you.’ ”

He told her that he was excited for the Libyans, whose revolt seemed finally to have succeeded, she said. Fischer called VanDyke’s mother with the news, and he called a short time later.

VanDyke’s release surprised human rights officials who had been searching for him.

Fred Abrahams, a special adviser for Human Rights Watch who visited the prison earlier this month, said his team had specifically asked about VanDyke. “We talked to one high official and we asked him about Matthew in particular,” Abrahams said. “He said, ‘We’re not familiar with this case.’ ”

It was a starkly different response from that of Libyan officials who had ultimately confirmed the detention of other foreigners, including four New York Times reporters and four freelance journalists, said Peter Bouckaert, the organization’s emergencies director, who had been working on VanDyke’s case since its beginning.

“The theory that Matthew has been kept in secret detention for so many months . . . is very unlikely and inconsistent with the treatment of other foreigners who were detained,” Bouckaert said in an e-mail to The Washington Post earlier this month.

But that seems to have been the case.

VanDyke’s release came the same day that several dozen journalists were released from confinement in a luxury Tripoli hotel. It followed, by a few days, the apparent escape of another Western prisoner from Abu Salim prison, who surfaced in Libya’s rebel-controlled Western mountains, Abrahams said. A Libyan-American doctor, Rida Mazagri, from Charlestown, W. Va., was also released from Abu Salim on Wednesday, he said.

Sherry VanDyke said she did not know where her son was or when he would return home. But she sounded jubilant and relaxed compared with how she had sounded in recent days as fighting raged through Tripoli and she wondered whether her son was close to it.

Now, she said, she is experiencing “just about every positive feeling. It’s just a great weight off my shoulders.”