Nobel Peace Prize laureate Malala Yousafzai (R-front) sits with her family and Pakistan Minister of State for Information and Broadcasting Marriyum Aurangzeb (L-back) while visiting her hometown Mingora in Swat Valley, Pakistan. (Photo: REUTERS/Stringer)

Nobel Peace Prize winner Malala Yousafzai left Pakistan for London on Monday after a four-day whirlwind visit back to her homeland, her first since militants nearly killed her in 2012, an official said.

Yousafzai and her family were taken to Islamabad airport in a security convoy and they boarded a London-bound flight, said aviation official Akmal Kayani.

Yousafzai, known by her first name, Malala, has been in Pakistan since Thursday, on her first trip home since Pakistani Taliban militants shot her in the head on her way home from school for advocating for greater education for girls.

After the attack, Yousafzai was airlifted abroad and underwent surgery.

Malala on Saturday visited her old home in the Swat valley, a mountain region northwest of Islamabad, which was under the control of the militants for about two years until the army launched an offensive to clear them out.

"I miss everything about Pakistan ... from the rivers, the mountains, to even the dirty streets and the garbage around our house," Malala, 20, told Reuters in an interview on Friday.

A family friend said earlier Malala planned to return home after completing her education at Oxford University, where she is reading for a degree in politics, philosophy and economics.

Malala wrote an anonymous blog for the BBC Urdu service as a schoolgirl during the Taliban rule and later became outspoken in advocating more educational opportunities for girls.

In 2014, Malala became the youngest Nobel laureate, honoured for her work with the MalalaFoundation, a charity she set up to support education advocacy groups with a focus on Pakistan, Nigeria, Jordan, Syria and Kenya.

ALSO WATCH | Image of the day: Malala Yousafzai returns to Pakistan six years after surviving Taliban attack