Donald Trump leads Hillary Clinton by nearly 20 points among voters with military experience, although they mostly prefer the former secretary of state to handle the nation’s nuclear weapons, according to a new NBC News/SurveyMonkey poll.

The online poll shows that a majority of voters don’t have confidence in either the Republican or Democratic presidential nominee to be an effective commander in chief of the nation’s military. When the question is put to military members and veterans, most say they are more confident about Mr. Trump’s ability to lead the military.

Mrs. Clinton was leading Mr. Trump, 48% to 42%, among all voters, according to the poll taken Aug. 29 to Sept. 4. But Mr. Trump led, 55% to 36%, among veterans and U.S. military members.

Mr. Trump’s lead is about the same as 2012 Republican nominee Mitt Romney’s 20-point margin among veterans over President Obama, according to the American National Election Studies survey.

When asked in the latest poll which candidate they trust to make the right decisions about using nuclear weapons, Mrs. Clinton led, 44% to 24%, among all voters and had a modest edge, 34% to 33%, among military voters.