London (CNN)Prince William will complete his final shift as an air ambulance helicopter pilot on Thursday night, Kensington Palace said, as he prepares to take on more royal duties.
The Duke of Cambridge was "incredibly proud" to have served with the East Anglian Air Ambulance for the past two years, the palace said, and is grateful for the experience.
Prince William announced in January that he would be stepping down from the role in the summer to take on more royal duties on behalf of the Queen and Prince Philip. Buckingham Palace said in May that Philip would be retiring from public life in the fall.
As William prepared to carry out his last shift, Kensington Palace tweeted a link to a farewell letter written by the prince to his colleagues and published in a local East Anglia newspaper.
In it, he described experiencing "moments of extreme emotion" and "profound grief" during his time as a pilot, which he said had influenced his determination to raise awareness of mental health issues.
"One of the first call outs I made was to a young man who had taken his own life; it was an incredibly tough day and had a profound effect on all of us, not least in my determination now to draw attention to this issue," he wrote.
William, who is second-in-line to the British throne, also said he had the "utmost respect for the job that our emergency services carry out, without fuss, on a daily basis" and that he hoped to continue championing their work.
East Anglian Air Ambulance chief executive Patrick Peal said William, who was one of only 11 pilots working with the charity, had been an integral member of the team.
"He is not only a fantastic pilot, but a much loved and valued member of the crew; he will be truly missed by everyone," he said.
"We can't thank William enough for his hard work and commitment to the charity during this time. He has been a true professional, delivering our doctors and critical care paramedics to patients under testing conditions."
William began flying for the East Anglian Air Ambulance, which operates across the Cambridge area, in July 2015. He donated his salary to charity.