The Queen described the campaigning work of Pakistani teenager Malala Yousafzai, who survived an assassination attempt by the Taliban, as "wonderful" when the pair met at Buckingham Palace.

Malala, 16, was shot in the head in Pakistan last October after campaigning for the right of girls to go to school without fear, in a part of the country where Islamic fundamentalists were trying to impose a strict form of Sharia.

Surgeons who treated her said she came within inches of death when the bullet grazed her brain in the school bus attack.

The schoolgirl, who was treated in Birmingham after the attack and now lives in the city, was a guest at a reception for commonwealth, youth and education hosted by the Queen and Duke of Edinburgh, and was selected as one of a handful of people to be presented to the royals.

She gave the Queen a copy of her book, I Am Malala, which the monarch accepted, adding: "That's very kind of you. Thank you very much indeed."

Malala told the Queen she was passionate about the right to an education. Speaking to the Queen, she said of her invite to the palace: "It is not just an invitation, it is an honour for me, and I hope we all work together for the education of every child, and especially in this country as well. I have heard about many children who cannot go to school."

The Queen, who was wearing a duck-egg blue Angela Kelly outfit, listened intently and nodded as Malala spoke of her aim for every child to have an education, and added: "It's wonderful, isn't it?"

Malala had a fit of giggles as the Duke then told her: "There's a thing about children going to school - they go to school because the parents don't want them in the house."

After meeting the Queen, Malala said that she would not ordinarily miss a day of lessons - but made an exception on this occasion.

"I had to miss school because I was meeting the Queen," she said. "It's such an honour for me to be here at Buckingham Palace. It's really an honour to meet the Queen.

"I also wanted to raise the issue of girls not being educated on a higher platform so that the government in each country takes action on it.

"We need to fight for education in the suffering countries and developing countries, but also here."

She and her father Ziauddin also spoke to the Queen and Duke about their past visits to Pakistan.

Malala said: " The most interesting thing was that when I met the Queen, I said, 'When you were in your 20s you came to Swat and came to the White Palace, where I'm from'.

"It is a beautiful valley. It is like paradise on earth."

The teenager, who has addressed the United Nations and been nominated for the Nobel Peace Prize, admitted she had been unsure of the etiquette surrounding being introduced to the Queen.

"I was really confused before meeting her, because some people said you have to curtsey, and some people said you should not talk until she talks," she said. "Then when I met her, it was quite good and she was really nice. She talked to me in a very friendly kind of way."

Princess Beatrice and the Duke and Duchess of Gloucester were also present at today's reception, attended by 350 guests from academic institutions around the world. I t included a performance from the Commonwealth Youth Orchestra and the choir of St Winefride's School from Manor Park, east London.

Beatrice, wearing a dark red Cos dress, dark red and navy Asos jacket and black Kurt Geiger heels, shook Malala's hand and told her: "It's so wonderful to meet you. What you've achieved is just so incredible.

"It's an incredible thing to have your campaign. I'm very honoured to be meeting you."

She added that her mother, Sarah, Duchess of York, would like to meet Malala, adding: "She has been completely moved by your strength and what you've achieved."

Other guests at the reception said it was a privilege to meet Malala.

Yaseen Ebrahim, from Hounslow, west London, who has dual South African and Tanzanian heritage, said: "Nelson Mandela said that education is the most important thing that people can have.

"The best example is Malala, and how she treasures education."

The 18-year-old said it was "an honour" to meet Malala and to have the chance to discuss education with her.

He added: "Pupils in South Africa appreciate education more than here, and yet it is so readily available here, you take it for granted."

Malala agreed, saying: "Nothing is important until you're deprived of it.

"I was living in Swat and I couldn't go to school because of terrorists."

She also referred to those in India who could not attend classes because of child labour, adding: "There are many hurdles in our way to get education.

"Here in the UK it's easy for most children to go to school. They don't realise it, but they're not just going to school, they're also building up their future."

She urged young people to "respect" their right to education and give it the importance it deserves, as well as standing up for those who do not have the same opportunities.

"We must not be silent," she said. "We must raise our voice."

Also on HuffPost:

Loading Slideshow...
  • Malala Yousafzai signs United Nations Secretary-General Ban Ki-moon's guest books as Ban Ki-moon, center, and youth delegates look on, Friday, July 12, 2013 at United Nations headquarters. (AP Photo/Mary Altaffer)

  • United Nations Secretary-General Ban Ki-moon, left, listens as Malala Yousafzai, right, addresses the ‘Malala Day’ Youth Assembly, Friday, July 12, 2013 at United Nations headquarters. (AP Photo/Mary Altaffer)

  • Malala Yousafzai poses for photographers before a meeting with United Nations Secretary-General Ban Ki-moon and youth delegates, Friday, July 12, 2013 at United Nations headquarters. (AP Photo/Mary Altaffer)

  • United Nations Secretary-General Ban Ki-moon, left, applauds as the members of the ‘Malala Day’ Youth Assembly wish Malala Yousafzai, center, a happy birthday, Friday, July 12, 2013 at United Nations headquarters. (AP Photo/Mary Altaffer)

  • Malala Yousafzai's holds a copy of the United Nations charter presented to her by Secretary-General Ban Ki-moon, Friday, July 12, 2013 at United Nations headquarters. (AP Photo/Mary Altaffer)

  • Former Birtish Prime Minister Gordon Brown, left, introduces Malala Yousafzai, third from left, background, during the ‘Malala Day’ Youth Assembly, Friday, July 12, 2013 at United Nations headquarters. (AP Photo/Mary Altaffer)

  • In this photo provided by the United Nations Foundation, Malala Yousafzai celebrates her 16th birthday by addressing hundreds of young leaders who support the United Nation’s Secretary General's Global Education First Initiative, during 'Malala Day' at United Nations Headquarters, Friday, July 12, 2013. (AP Photos/United Nations Foundation, Stuart Ramson)

  • United Nations Secretary-General Ban Ki-moon, right, holds Malala Yousafzai's hand while posing for photographers, Friday, July 12, 2013 at United Nations headquarters. (AP Photo/Mary Altaffer)