His release came after the international community condemned the coup and called on the military to release all government officials who were detained when Gen. Abdel-Fattah Burhan seized power on Monday.
The official did not say whether Hamdok and his wife were free to move or make calls, adding that their house in Khartoum's upscale Kafouri neighborhood was ``under heavy security.'' He spoke on condition of anonymity because he was not authorized to brief the media.
Burhan had said earlier Tuesday that Hamdok had been held for his own safety and would likely be released. But he warned that other members of the dissolved government could face trial as protests against the putsch continued in the streets.
A day after the military seized power in a move denounced abroad, pro-democracy demonstrators blocked roads in the capital of Khartoum with makeshift barricades and burning tires. Troops fired on crowds a day earlier, killing four protesters, according to doctors.
The takeover came after weeks of mounting tensions between military and civilian leaders over the course and the pace of Sudan's transition to democracy. It threatened to derail that process, which has progressed in fits and starts since the overthrow of longtime autocrat Omar al-Bashir in a popular uprising two years ago.
The U.N. Security Council was to discuss the situation in Sudan, a nation in Africa linked by language and culture to the Arab world, at a closed-door meeting later Tuesday. U.N. Secretary-General Antonio Guterres urged world powers to come together to act decisively at the council, saying unity was needed to confront an ``epidemic of coups d'etat'' recently.
In his second public appearance since seizing power, Burhan said Tuesday the military was forced to step in to resolve a growing political crisis.
``There were people who were talking about discriminating against others, and that was driving this country to reach a civil war that would lead to the fragmentation of this country, tearing apart its unity, its fabric and society. These dangers were in front of us,'' Burhan told a televised news conference.
But the coup came less than a month before Burhan was supposed to hand the leadership of the Sovereign Council that runs the country to a civilian, a step that would have decreased the military's hold on power.
``The whole country was deadlocked due to political rivalries,'' Burhan said. ``The experience during the past two years has proven that the participation of political forces in the transitional period is flawed and stirs up strife.''
Of the slew of senior government officials detained Monday, some tried to incite a rebellion within the armed forces, Burhan alleged, saying they would face trial. Others who are found ``innocent'' would be freed, he said.
Hamdok had been held at Burhan's home, the general said, and was in good health.
But Hamdok's office issued a statement voicing concern for his safety and for other detained officials. The statement accused the military leaders of acting in concert with Islamists, who have argued for a military government, and other politicians linked to the now-dissolved National Congress Party, which dominated Sudan during al-Bashir's Islamist-backed rule.
Western governments and the U.N. have condemned the coup and called for the release of Hamdok and other senior officials. U.S. President Joe Biden's administration announced the halt of $700 million in emergency assistance to Sudan and said Tuesday it was looking at sending stronger signals to the generals.
``They should first and foremost cease any violence against innocent civilians, and ... they should release those who have been detained and they should get back on a democratic path,'' said National Security Advisor Jake Sullivan, adding that the U.S. is working with countries in Gulf, where the generals have allies.
Mariam al-Mahdi, the foreign minister in the government that the military dissolved, was defiant Tuesday, declaring that she and other members of Hamdok's administration remained the legitimate authority in Sudan.
``We are still in our positions. We reject such coup and such unconstitutional measures,'' she told The Associated Press by phone from her home in Khartoum. ``We will continue our peaceful disobedience and resistance.''
The Ministry of Culture and Information, which remains loyal to the deposed government, said in a Facebook post Tuesday that three of Sudan's ambassadors, in Belgium, Switzerland and France, have defected.
Nureldin Satti, the Sudanese envoy to the U.S., said he was working with those diplomats to ``resist the military coup in support of the heroic struggle of the Sudanese people'' to achieve the aims of the uprising against al-Bashir. But he did not specify whether he, too, had defected.
Al-Mahdi, meanwhile, spoke to the wife of one of the officials detained, Minister of Cabinet Affairs Khalid Omar, and said he was humiliated and mistreated during his arrest.
``They (military forces) took Khalid barefoot, wearing only his nightclothes,'' she said.
Hours after the arrests, Sudanese flooded the streets of Khartoum and other cities in protest. At least four people were killed and over 80 wounded when security forces opened fire, according to the Sudan Doctors' Committee. Human Rights Watch said forces used live ammunition against the demonstrators.
The country and the world are waiting to see if more violence will unfold in the nation, which saw a bloody crackdown on pro-democracy protests in 2019. Some protesters blocked streets on Tuesday. Later, online video showed demonstrators marching in several neighborhoods of Khartoum and its twin city of Omdurman. They chanted, ``Retribution!'' and ``Blood for blood, we won't accept compensations!''
A bigger test of how the military will respond to the resistance could come Saturday when protesters plan a mass march to demand a return to civilian rule.
The Sudanese Professionals' Association, a group of unions which was behind the uprising against al-Bashir, also urged people to go on strike and engage in civil disobedience. Separately, the Sudan Popular Liberation Movement-North, the country's main rebel group, denounced the coup and called for people to take to the streets.
In a sign of the divisions among the civilian leaders in Sudan, a group known as the Justice and Equality Movement blamed the deposed government for the military's takeover. It said a few officials had monopolized decision-making and refused to engage in talks to ease tensions.
The group, headed by Finance Minister Gibreil Ibrahim, is the first to publicly voice support for the military but also urged it to end the state of emergency, release the detainees and appoint a civilian government to run day-to-day activities. Earlier this month, the group had taken part in a pro-military sit-in in Khartoum.
Another pro-military group that splintered from the protest movement that ousted al-Bashir also welcomed the takeover, saying it would end a sit-in it had organized outside the presidential palace to support the generals earlier this month.
The military has sent mixed signals about what is ahead for Sudan. Burhan promised to gradually restore internet and communications services that were severely disrupted during the coup. But the Civil Aviation Authority said it was suspending all flights to and from Khartoum International Airport until Oct. 30.
On Monday, Burhan dissolved the Hamdok government and the Sovereign Council, a joint military and civilian body created after al-Bashir's ouster to run the country. He now heads a military council that he said would rule Sudan until elections in July 2023.
The general said he is serious about holding elections on schedule. But much could happen in the next 19 months, and it is not clear if the military will be willing to release the grip it has had for decades.