Salah Gosh, the head of Sudan's feared National Intelligence and Security Service (NISS), has resigned from his post, the country's new military rulers have said on Saturday.

"The chief of the transitional military council, Abdel Fattah al-Burhan, has accepted the resignation of ... the chief of NISS," the transitional military council said.

Gosh had overseen a sweeping crackdown led by NISS agents against protesters taking part in four months of mass demonstrations that led up to the toppling of longtime president Omar al-Bashir in a palace coup by the army on Thursday.

Thousands of protesters, opposition activists and journalists were arrested during the crackdown.

Last month, Middle East Eye revealed that Gosh had held secret talks with the head of Mossad in Germany in February as part of a plot hatched by Israel's Gulf allies to elevate him to the presidency if Bashir was toppled from power.

Highlighting what appeared to be a divide between lower ranks of the army and the NISS, clashes had erupted on Tuesday between soldiers trying to protect protesters against Bashir's rule and intelligence and security personnel trying to disperse them.

New military leader

Gosh's resignation comes just a day after Defence Minister Awad Ahmed ibn Auf, who was sworn in to lead the transitional military council on Thursday, stepped down from the post after less than 24 hours into the role.

Ibn Auf was replaced by Lieutenant General Abdel Fattah al-Burhan, who was sworn in as transitional ruler on Friday evening.

In his first televised address on Saturday, Burhan said that a civilian government would be established after consultations with opposition forces and promised that the transitional period would last for a maximum of two years.

He also announced the lifting of a night curfew implemented by his predecessor and ordered the release of all prisoners jailed under emergency laws ordered by Bashir.

Meanwhile, Bashir's party urged the country's new ruling military council Saturday to release him and other key members.

"We consider the military council's power grab a violation of constitutional law," the National Congress Party said in a statement. "The NCP rejects the detention of its leaders, among them its acting president and a large number of prominent members, and calls for their immediate release."

Gosh's CIA connections

Gosh was well known in the US, where he earned a reputation during the 2000s as a spy chief with whom the CIA could work in the "war on terror" against al-Qaeda, even visiting the US in 2005 when, as now, Sudan was listed by the State Department as a state sponsor of terrorism.

Gosh headed NISS between 2004 and 2009, when Bashir appointed him as his national security adviser.

He was sacked in 2011 and later arrested on suspicion of involvement in a coup plot, but was released with a presidential pardon in 2013.

Scared, worried and hopeful: A Sudanese photographer's view of the uprising

The Sudanese Professional Association (SPA), a leading group in the protest campaign that began late last year against Bashir, called ibn Auf and Mahi's resignation a "victory for the will of the masses".