The announcement came as the ruling military and civilian protesters agreed last week to end a political impasse after the army in April ousted longtime ruler Omar al-Bashir on the back of a popular uprising.
"Officers and soldiers from the army and National Intelligence and Security Service, some of them retired, were trying to carry out a coup," General Jamal Omar of the ruling military council said in a statement broadcast live on state television.
"The regular forces were able to foil the attempt," he said, but did not say when the attempt was made.
Omar said of the 12 officers arrested, five of them were retired, and that security forces were looking for the mastermind of the attempted coup.
"This is an attempt to block the agreement which has been reached by the Transitional Military Council and the Alliance for Freedom and Change that aims to open the road for Sudanese people to achieve their demands," Omar said.
The announcement late on Thursday came as legal advisors of the ruling military council and protest leaders were going through the details of the agreement at a luxury hotel in Khartoum.
The landmark agreement that aims to form a new joint transitional civilian-military ruling body was reached last week after mediation by African Union and Ethiopian envoys.
The forming of the new governing body is the first step towards installing an overall transitional civilian administration in Sudan as demanded by demonstrators.
Sudan has been rocked by a political crisis since protests first erupted against Bashir's rule in December.
The protests finally led to the army ousting him on April 11, but the generals who seized power have so far resisted demonstrators' demands to hand it over to a civilian administration.
Tension had further soared between the two sides after a brutal raid on a longstanding protest camp outside army headquarters in the capital Khartoum that killed dozens of demonstrators and wounded hundreds on June 3.
The raid came after talks between the generals and protest leaders collapsed in May over who should lead the new governing body -- a civilian or soldier.
Intense mediation by African Union and Ethiopian mediators finally led to the agreement reached on the new joint governing body on July 5.
The agreement proposes a little more than a three-year transition period, with the president of the new ruling body to be held by the military for the first 21 months and a civilian for the remaining 18 months.
The ruling body would comprise of six civilians, including five from the protest movement, and five of the military.