ISLAMABAD, Pakistan — Malala Yousafzai, the Pakistani activist for girls’ education and the world’s youngest Nobel laureate, visited her hometown in Pakistan on Saturday for the first time since the Taliban attempted to assassinate her in 2012.

Her return under heavy security to the city of Mingora in the Swat Valley — a former Taliban stronghold — was a deeply emotional moment for Ms. Yousafzai and her family.

“I wish to be in Swat, to be among you and serve you,” Ms. Yousafzai said with tears in her eyes as she met with former schoolmates and relatives at her old family house. “It is still like a dream for me to be among you,” she said, her voice quavering.

Ms. Yousafzai’s visit reflected how Pakistan has changed and how it hasn’t since the attempt on her life more than five years ago. The Taliban are now all but banished from Swat. But many Pakistanis are still deeply suspicious of Ms. Yousafzai’s mission to educate girls and empower women.