Media playback is unsupported on your device Media caption Malala Yousafzai began her blog at the age of 11

Surgeons have removed a bullet from the head of a 14-year-old girl, a day after she was shot by Taliban gunmen in north-western Pakistan's Swat Valley.

The operation on Malala Yousafzai, a campaigner for girls' rights, went well, her father told the BBC.

The attack sparked outrage among many Pakistanis, who gathered in several cities for anti-Taliban protests and held prayers for the girl's recovery.

The militants said they targeted her because she "promoted secularism".

A spokesman for the Islamist militant group, Ehsanullah Ehsan, told BBC Urdu on Tuesday she would not be spared if she survived.

The BBC's Aleem Maqbool in Islamabad says the authorities will now have to consider how to protect the girl.

He says her family never thought about getting security because they just did not think that militants would stoop so low as to target her.

Two other girls were injured in Tuesday's attack, one of whom remained in a critical condition on Wednesday.

'Icon of courage'

Malala Yousafzai came to public attention in 2009 by writing a diary for BBC Urdu about life under Taliban militants who had taken control of the valley.

Analysis Even if Malala Yousafzai survives, life is not going to be the same for her and her family. No place in Pakistan is safe for people targeted by militant groups. She may have to live under state security or in asylum abroad. In either case, her life and her ability to campaign for girls' education in north-western Pakistan will be severely limited. Malala Yousafzai rose to fame because of her innocent but courageous desire to attend school, which translated into a one-girl campaign of resistance when Taliban captured Swat valley in 2009 and ordered girls' schools closed. Several hundred in Swat and neighbouring Bajaur and Mohmand were destroyed. Only a few in urban areas have been rebuilt. The government's inability to rebuild is matched by its ambivalence towards the Taliban, which has enabled them to carry out acts of sabotage with impunity. The question is, will it change now? The attempt on Malala Yousafzai's life has shocked and angered the nation, and reports from parliament suggest a wider anti-Taliban consensus might be in the works - something Pakistan's fractious politicians have rarely achieved before.

The group captured the Swat Valley in late 2007 and remained in de facto control until they were driven out by Pakistani military forces during an offensive in 2009.

While in power they closed girls' schools, promulgated Islamic law and introduced measures such as banning the playing of music in cars.

Malala Yousafzai's brother, Mubashir Hussain, told the BBC that the militants were "cruel, brutal people" and urged all Pakistanis to condemn them.

Pakistani politicians led by the president and prime minister condemned the shooting, which the US state department has called barbaric and cowardly.

President Asif Ali Zardari said the attack would not shake Pakistan's resolve to fight Islamist militants or the government's determination to support women's education.

Army chief Gen Ashfaq Parvez Kayani visited Malala in hospital on Wednesday and said the Taliban had "failed to grasp that she is not only an individual, but an icon of courage".

Thousands of people around the world have sent the teenage campaigner messages of support via social media.

Media playback is unsupported on your device Media caption Teachers and students condemn the attack on Malala Yousafzai

Schools in the Swat Valley closed on Wednesday in protest at the attack, and schoolchildren in other parts of the country prayed for the girl's recovery.

Protests were held in Peshawar, Multan and in Malala's hometown of Mingora, and another rally was expected in Lahore.

Late on Tuesday, she was flown from Mingora, where the attack happened, to the city of Peshawar, 150km (95 miles) away, for surgery.

Doctors in Peshawar operated on her for hours before managing to remove the bullet early on Wednesday.

"The operation went well, now she is ok and the swelling is down," her father, Ziaudin Yousafzai, told BBC Pashto.

"Please pray for her, the next 24 to 48 hours are very important. Doctors are saying we don't need to shift her. It's good for her to be here now."

A medically equipped plane had been placed on standby at Peshawar airport as medical experts tried to determine whether she would need further treatment overseas.

Police said they had arrested more than 40 people in the area, but all were later released on bail.

Correspondents say the arrests are part of a routine, and even the police do not believe they have found the attackers.

At that time some of us would go to school in plain clothes, not in school uniform, just to pretend we are not students, and we hid our books under our shawls Malala Yousafzai Swat women on changing life Diary of a Pakistani schoolgirl

Malala Yousafzai earned the admiration of many across Pakistan for her courage in speaking out about life under the rule of Taliban militants, correspondents say.

She was just 11 when she started her diary, two years after the Taliban took over the Swat Valley and ordered girls' schools to close.

Writing under the pen-name Gul Makai for BBC Urdu, she exposed the suffering caused by the militants.

Her identity emerged after the Taliban were driven out of Swat. She later won a national award for bravery and was nominated for an international children's peace award.

Since the Taliban were ejected, there have been isolated militant attacks in Swat but the region has largely remained stable and many of the thousands of people who fled during the Taliban years have returned.