Adm. Mike Gilday, the Navy’s top officer, has written a letter to the fleet Friday telling sailors that their mission and service in Afghanistan "was not in vain and it made a difference." 

The letter – which was obtained by Fox News – was sent after the leaders of the Army and Marines penned similar messages this week to their troops. 

"As the events in Afghanistan unfolded this past week, some of you may question whether your contributions and sacrifice were worth it. I want to be very clear: your service was not in vain, and it made a difference," Gilday wrote. "For 20 years, you have deployed in support of the mission in Afghanistan. Whether on the ground, from the sea, or from the air, Sailors fought tirelessly to keep our homeland safe, and to uphold principles which we hold dear." 

CLICK HERE TO GET THE FOX NEWS APP 

"While we must remain focused, at the same time I encourage each of you to reflect on your service, reach out to those who may be struggling, and remember those who made the ultimate sacrifice in service to a grateful Nation," Gilday added. 

"In 2001, we went to war to protect our Nation and bring justice to those who committed cold-blooded attacks on our country," he also wrote. "We went to war to defend our citizens, our friends, and our allies. We went to war to protect freedom – a fragile ideal, but one worth defending." 

Fox News’ Lucas Tomlinson contributed to this report.