A teenage Pakistani children's rights activist was shot in the head Tuesday in an assassination attempt as she boarded a school bus in the former Taliban stronghold of Swat, officials said.

Malala Yousafzai, 14, was taken first to a local hospital and then to the northwestern city of Peshawar for further treatment, but doctors said she was out of danger. One of her friends was also wounded, police said.

She won international recognition for highlighting Taliban atrocities in Swat with a blog for the BBC three years ago, when the Islamist militants led by radical cleric Maulana Fazlullah burned girls' schools and terrorised the valley.

She received the first ever national peace award from the Pakistani government last year and was nominated for the International Children's Peace Prize by advocacy group KidsRights Foundation in 2011.

Tuesday's shocking incident in broad daylight in Mingora, the main town of the once much-loved northwestern valley, raised serious questions about security more than three years after the army claimed to have crushed a Taliban insurgency.

Doctors at the Saidu Sharif Medical Complex in Mingora said that Malala was out of danger after the bullet penetrated her skull but missed her brain.

"A bullet struck her head, but the brain is safe," said Doctor Taj Mohammed. "She is out of danger."

Doctor Lal Noor, from the same hospital, also said the bullet missed her brain and that she was in a stable condition.

There was no immediate claim of responsibility for the shooting.

"Malala was getting into her school bus after school when two gunmen opened fire on her, injuring her and one of her friends," local police official Rasool Shah told AFP.

Provincial information minister Mian Iftikhar Hussain blamed the attack on terrorists and said Malala would be flown to Peshawar for further treatment.

The Pakistan army went into battle against the two-year Taliban insurgency in Swat in 2009. Fierce fighting displaced around two million people, but the army declared the region back under control in July 2009.

Malala's blog on the BBC Urdu website at the time was anonymous. She also featured in two New York Times documentaries.

In a 2011 BBC news report, she read out an extract of her diary that gave a sense of the fear she endured under the Taliban.

"Last night I had a scary dream in which I saw soldiers, helicopters and Taliban. I'm having such kind of dreams ever since the army operation started in Swat. Mother prepared breakfast for us and then I left for school," she said.

"I was very much scared because the Taliban announced yesterday that girls should stop going to schools.

"Today our head teacher told the school assembly that school uniform is no longer compulsory and from tomorrow onwards, girls should come in in their normal dresses. Out of 27, only 11 girls attended the school today," she said.

Despite sporadic outbreaks of violence, the government is trying to encourage tourism back to Swat, which had been popular with holidaymakers for its stunning mountains, balmy summer weather and winter skiing.

On Wednesday, state carrier Pakistan International Airlines (PIA) is scheduled to hold a test flight to Saidu Sharif, Mingora's twin town, for the first time since flights were suspended due to the insurgency.

"We believe that normalcy has returned to the area, which attracts a lot of foreign and local tourists," PIA spokesman Sultan Hassan told AFP.

"PIA will announce a regular flight schedule very soon. There will be two flights a week to Swat," he added.