WASHINGTON (Reuters) - A group of 10 retired top U.S. military officials endorsed U.S. Vice President Kamala Harris in a letter made public on Monday, saying she is the only presidential candidate fit to serve as the nation's commander in chief and calling her Republican rival Donald Trump "a danger to our national security and democracy."

The letter, signed by Retired General Larry Ellis and Retired Rear Admiral Michael Smith, among others, cited Trump's comments disparaging members of the military and his own "chaotic approach" to Afghanistan ahead of the U.S. withdrawal, including negotiating a deal with the Taliban that allowed 5,000 of the group's fighters to return to the battlefield.

In contrast, they wrote, Harris "has demonstrated her ability to take on the most difficult national security challenges in the Situation Room and on the international stage," from Russia's invasion of Ukraine to tensions with China in the Indo-Pacific.

"Harris is the best -- and only -- presidential candidate in this race who is fit to serve as our commander in chief," they wrote in the letter posted on X by Harris' campaign.

The Democratic vice president and Trump, who is running for the third time after serving from 2017 to early 2021, face a tight race before the Nov. 5 election in an unprecedented contest in which the future of American democracy looms large.

The letter coincided with a new Harris campaign ad released before the two candidates' Tuesday night debate featuring former Trump officials warning that a second Trump presidency would pose major risks. 

"In 2016 Donald Trump said he would choose only the best people to work in his White House. Now, those people have a warning for America. Trump is not fit to be president again, fears his vice president," the ad says. It featured videos from Trump's former vice president, Mike Pence, former Defense Secretary Mike Esper, former national security adviser John Bolton, and former chairman of the Joint Chiefs of Staff General Mark Milley. 

The letter also comes a day before House Speaker Mike Johnson hosts a congressional gold medal ceremony honoring the 13 service members killed in the chaotic Afghanistan withdrawal in August 2021. Trump and his fellow Republicans have tried to blame Harris for the Afghanistan pullout, with those in Congress issuing a report on Monday.

The retired military officials, in their letter, blamed Trump for "failing to take responsibility for his own role in putting service members in harm's way," noting his deal to free Taliban fighters without involving the Afghan government and for not leaving a withdrawal plan after he left office following his 2020 election loss.   

(Reporting by Susan Heavey and Doina Chiacu, Editing by William Maclean)