When the United States chose its first president in 1788, Americans turned to George Washington who, as an army general, had led them to victory over the British and independence. The acclaim that he had received as a war hero made him a unifying figure and gave him tremendous power.

As historian Ron Chernow has written, the first Commander-in-Chief made a decision to wear a brown suit rather than his army uniform to his inauguration, which helped ease fears that the fledgling democracy might be taken over by a military coup.

Since Washington, the nation often has elevated other veterans to its highest office. According to a list compiled by the U.S. Veterans Administration, 31 of the nation’s 45 presidents served in the military in some capacity.

Wars have sometimes produced multiple future presidents, including four who served in the Revolutionary War, seven who served in the Union Army during the Civil War, and another eight who served during World War II (counting Jimmy Carter, who was a midshipman at the U.S. Naval Academy, and Ronald Reagan, who remained stateside in the U.S. Army because of poor eyesight).

Some presidents, like Washington, were generals who won great victories. Andrew Jackson led U.S. forces to victory in the battle of New Orleans during the War of 1812. Zachary Taylor achieved fame by marching on Buena Vista and defeating an army three times the size of his own forces during the Mexican-American War. Dwight D. Eisenhower, the supreme Allied commander in Europe during World War II, orchestrated the D-Day invasion.

Others held lesser ranks but distinguished themselves in combat. William McKinley started the Civil War as a humble private in the Ohio volunteers, and became a hero at the battle of Antietam by dodging enemy fire to bring warm food and hot coffee to other troops in the fray.

During World War II, Navy Lt. John F. Kennedy, commander of a Patrol Torpedo boat in the Pacific, survived a collision with a Japanese destroyer and swam to safety while towing a wounded member of his crew. His Navy comrade, Lt. George H.W. Bush, was a pilot who flew 58 combat missions against the Japanese and was shot down during a bombing raid.

Military credentials were once viewed as so crucial to political aspirations that during World War II, future President Lyndon B. Johnson, who went to the south Pacific as an observer, pressed hard for a chance to fly on a bombing mission, which nearly got him killed. In recent decades, though, fewer veterans have made it to the White House.

The 2012 election, in which incumbent Barack Obama defeated challenger Mitt Romney, was the first since World War II in which neither candidate had served in the armed forces. Current President Donald Trump received a medical deferment that enabled him to avoid service during the Vietnam War.

Even so, American voters appear to still value military experience in a president. A 2016 Pew Research Center survey found that 50 percent of Americans would be more likely to vote for a presidential candidate with military experience—the highest-ranked of the 13 traits that pollsters asked about.