Media playback is unsupported on your device Media caption Donald Trump: "I'm here to talk to you about three crucial words...peace through strength"

Republican presidential nominee Donald Trump has said he will expand all areas of the US military if he wins November's election.

Mr Trump called for more troops, more planes and more boats at a rally in Philadelphia.

He also wants US generals to come up with a plan to defeat the self-styled Islamic State (IS) in his first 30 days in the White House.

Recent polls show the race for the presidency has narrowed.

Democrats and even some Republicans have painted Mr Trump as unfit to serve as US commander-in-chief but he has made up some ground on rival Hillary Clinton.

In his speech he called his vision for the US military "peace through strength".

Live updates from Clinton and Trump at veterans' forum

Analysis - Anthony Zurcher, BBC News, Washington

It was back to the future for Republican presidential candidate Donald Trump who in delivering his national security speech often sounded more like Ronald Reagan than the outsider who spent much of his primary campaign railing against his party's foreign policy elite.

Mr Trump even cribbed one the former president's favourite phrases, "peace through strength", when explaining why he was in favour of across-the-board increases in US military spending.

There were flashes of the old Donald Trump, of course - such as when he railed against nation-building and military entanglements in the Middle East. Those lines were as much a criticism of Republican former President George W Bush and his neo-conservative advisers as President Barack Obama and Democratic nominee Hillary Clinton. (Never mind the fact that Mr Trump did, in fact, support the Iraq War and military intervention in Libya.)

For the most part, however, Mr Trump's speech was one that the conservative establishment could embrace. Reagan made appeals to the military and security-minded voters a key part of his winning electoral strategy in the 1980s. It appears Mr Trump is betting that he can do the same.

"I am proposing a new foreign policy focused on advancing America's core national interests, promoting regional stability, and producing an easing of tensions in the world. This will require rethinking the failed policies," he said.

"Our adversaries are chomping at the bit," he added.

Mr Trump said his plan would be paid for by cutting government waste, collecting uncollected taxes and slimming down the federal workforce.

He also called for US Nato allies to meet their obligations to spend 2% of national income on defence.

Earlier this week, Mr Trump was endorsed by 88 former military leaders in an open letter, who declared the Republican nominee "has the temperament to be commander-in-chief".

Trump v the generals

That Mr Trump says he will ask US military leaders how to defeat IS appears to be a change of approach. Here is what he said previously:

"I know more about Isis (Islamic State) than the generals do. Believe me" - at a rally in November 2015

"I have a great plan. It's going to be great. They ask: 'What is it?' Well, I'd rather not say. I'd rather be unpredictable" - on his strategy for defeating IS in April this year

US generals "don't know much because they're not winning" - to CBS in June

"Immediately after taking office, I will ask my generals to present to me a plan within 30 days to defeat and destroy Isis" - his comments on Wednesday

Both Mr Trump and Mrs Clinton will take part back-to-back in a national security forum on Wednesday.

The forum, to be hosted by the Iraq and Afghanistan Veterans of America, will include questions from an audience of military service members.

Image copyright Reuters Image caption Rival Hillary Clinton says American voters see Mr Trump as a danger

During his speech Mr Trump attacked Mrs Clinton as "trigger-happy and very unstable".

But on Tuesday Mrs Clinton said US voters "know they can count on me to be the kind of commander-in-chief who will protect our country and our troops, and they know they cannot count on Donald Trump".

She added: "They view him as a danger and a risk.''

Despite making support for the military a signature issue in his campaign, Mr Trump has at various times drawn criticism from military members.

Most notably, he was involved in a spat with family members of a Muslim-American soldier killed during the Iraq War.

Some veterans and families of military members killed in action protested outside Trump Tower in New York on Wednesday.