The bomb was apparently intended to kill town Mayor Vivencio Bataga, police said. The suspected bomber was among those killed.
The gymnasium is near Camp S. K. Pendatun, the police headquarters of the Autonomous Region in Muslim Mindanao (ARMM).
One of those killed was Salman Macarambang, son of the re-electionist vice mayor of Barira town also in Maguindanao.
Lt. Col. Fredesvindo Covarrubias, chief of the Armys 4th Civil Relations Group (CRG) in Mindanao, said Bataga had just delivered his speech for the local basketball league at the gymnasium when the bomb went off.
It was unclear what kind of explosive was used or who was behind the blast. Many of those hit by shrapnel and injured in the stampede that followed were children and women, police said.
"The mayor was wounded but he is fine," town councilor Gaudencio Teves said. "I saw 10 people dead." He added that the wounded were rushed to different hospitals.
Bataga sustained shrapnel wounds in different parts of the body, while three of his bodyguards were critically wounded in the attack. Two of the bodyguards are soldiers, identified only as Cpl. Tajal and Pfc. Arsenal.
As of press time, Bataga was undergoing surgery at the Notre Dame Hospital in Cotabato City.
Regional police chief Isnadji Bantala said he has ordered all officers in the town to "secure the place and pursue the suspects" but said no one has claimed responsibility.
"This is something political. Bataga survived similar attacks in the past," he said. He ruled out the involvement of Muslim separatists and the al-Qaeda-linked Jemaah Islamiyah terror group.
Bataga is a former Army colonel who is seeking re-election in the May polls and police said he survived at least three attempts on his life last year. Bataga had blamed his political rivals for the attacks.
Bataga is known for his strong anti-insurgency stance and his iron-fisted policy in dealing with lawless elements operating in his town. He was targeted twice in bomb attacks in Parang town by suspected partisans. Bataga also survived an ambush by gunmen as he was on his way home from the office.
"We condemn this attack. We believe this is politically motivated," Bantala said. "Bataga was believed to be the target."
Military bomb experts said the explosive used in the attack was fashioned out of highly combustible powder and rigged with a battery-operated blasting device packed inside the gasoline tank of a motorcycle.
The motorcycle was parked by the suspected bomber near the gymnasium bleachers where Bataga and his bodyguards sat. Army ordnance experts said the home-made bomb was packed with nails and jagged fragments of cast iron. With AFP