Catherine, Princess of Wales and Prince William on Thursday made their first joint public engagement since she ended a course of chemotherapy for cancer, Kensington Palace announced.
The couple visited Southport in northwest England, "to show support to the community and hear how local people have come together as the town recovers" from a July knife attack that killed three children, the palace said.
The princess, better known as Kate, and William met members of the emergency services who attended after the stabbing spree at a Taylor Swift-themed dance class, which also left eight children and two adults wounded.
The couple, both 42, heard "about their experiences of responding to the attack and the impact it has had on their mental health," their office said in a statement.
The royals also met mental health practitioners who have been supporting emergency responders since the attack.
Having met the families of the victims of the July 29 rampage earlier in the day, Kate told the emergency workers "how grateful they all are for the support you provided on the day".
"On behalf of them, thank you," she said, according to Britain's domestic Press Association (PA) news agency.
Away from the cameras, Kate hugged some of the attendees after they became emotional, it was reported.
William told the responders: "You're all heroes. Please make sure you look after yourselves, please take your time, don't rush back to work."
The Kensington Palace statement said that ensuring emergency responders receive long-term mental health support following traumatic events was a cause "close to the heart" of William.
It noted the heir to the throne has "first-hand experience as an emergency responder while serving as a pilot" for a civilian air ambulance service and in the military flying search and rescue helicopters.
- Royal recoveries -
Kate announced on September 9 that she had finished chemotherapy treatment and was striving to be cancer-free.
In a highly emotional video message following her shock diagnosis that saw her stay out of the public eye for months, she said she was on a long road to "full recovery".
A week later, she took a first step towards returning to work on the early-years development of children, meeting with staff from the Royal Foundation Centre for Early Childhood which she established.
It was seen as a further positive sign that Kate was making good progress in her cancer battle and tentatively returning to public duties.
Her health woes have coincided with father-in-law King Charles III also receiving treatment following his own cancer diagnosis earlier this year.
The 75-year-old monarch was given the green light to resume public duties in April. Neither royal has disclosed what type of cancer they had.
Footage of Thursday's engagement showed Kate, wearing a long brown coat, arriving at a Southport community centre after meeting privately with the families of the attack victims and a dance teacher who was injured on July 29.
She and William spent around half an hour with each of the three family groups and were 45 minutes late arriving at the centre, PA said.
William could be heard apologising to the waiting guests on arrival, it added.
Unrest and riots erupted in English towns and cities in the week that followed the events in Southport, with authorities blaming misinformation over the identity of the alleged attacker.
Axel Rudakubana, who was aged 17 at the time, has been charged with murder and attempted murder over the stabbing spree.
He is due in court this month for a hearing.