Donald Trump and First Lady Melania Trump arrive for the "Salute to America" Fourth of July event. (AFP)

It was a setting tailor-made for President Donald Trump to launch into a partisan address, with a VIP crowd in front of him that included Republican donors and a display of military armor and aircraft he had personally ordered for a "Salute to America" on the National Mall.

But during the Fourth of July extravaganza, the president diverged from his typical self-aggrandizing speaking style and instead turned his praise toward the military and ordinary Americans who have contributed to the country's advancement.

"As we gather this evening in the joy of freedom, we remember that all share a truly extraordinary heritage," Trump said from the steps of the Lincoln Memorial, where rain had drenched and scattered some of those gathered. "Together, we are part of one of the greatest stories ever told - the story of America. It is the epic tale of a great nation whose people have risked everything for what they know is right and what they know is true."

US President Donald Trump at the "Salute to America" ceremony. (AFP)

The event was clouded in controversy in part because of the fear that the president was inserting himself into a typically nonpolitical event and planning to use a taxpayer-funded celebration of military power to bolster his own political prospects.

But Trump largely steered clear of rank partisanship and instead spoke of the history of America's founding while reveling in the displays of military might from the US armed forces.

He introduced the five branches of the US military as aircraft from the Army, Navy, Marines, Coast Guard and Air Force flew overhead. Abrams tanks and Bradley Fighting Vehicles were also stationed on the National Mall, as a B-2 bomber and F-22 fighter jets flew overhead.

For months, the president had taken special interest in the event, receiving regular briefings and requesting specific features, from tanks to Air Force One.

"July 4th is being turned into a big campaign event," Julian Zelizer, a professor of history and public affairs at Princeton, said Thursday before Trump's speech on Twitter.

Before the address, heavy rain drenched much of Washington, leaving many attendees on the National Mall soaked or scrambling to find shelter.

During Trump's opening remarks, he specifically referred to several people in the crowd - including an astronaut, a nun, a hurricane volunteer, a 1960s civil rights activist and others - telling stories of individual heroism.

"Americans love our freedom and no one will ever take it away from us," he said. "For Americans, nothing is impossible."

The president name-checked the women's suffrage movement and the civil rights movement, referring to several prominent American historical figures.

"In 1963, Rev. Dr. Martin Luther King Jr. stood here on these very steps and called on our nation to live our the true meaning of its creed and let freedom ring for every citizen all across our land," he said. "America's fearless resolve has inspired heroes who defined our national character from George Washington, John Adams and Betsy Ross to . . . the great Frederick Douglass, Harriet Tubman, Amelia Earhart, Douglas MacArthur, Dwight Eisenhower, Jackie Robinson and of course, John Glenn."

People watch a military fly over on the National Mall. (AFP)

The president's reference to Betsy Ross was the closest he came to offering political red meat to his base. Ross, who created the first American flag, became the subject of controversy this week after Nike halted the sale and production of sneakers sporting the Betsy Ross flag. Former NFL quarterback Colin Kaepernick - a Nike spokesman - told the company the design was offensive, the Wall Street Journal reported.

Conservatives have rallied to Ross' defense in recent days.

Trump spoke to a crowd that was divided between a VIP section for supporters and donors near the stage and an area for the general public held at bay by chain link fences far away. All together, thousands of people gathered to witness flyovers by military aircraft, musical performances and a 35-minute fireworks show.

With poor weather, Trump, who has long obsessed over crowd size, faced the prospect of having a repeat of the relatively sparse crowds that marked his inauguration in 2017.

"Salute to America" Fourth of July event at the Lincoln Memorial. (AFP)

The west front of the US Capitol grounds, near the area of a planned concert, was evacuated after 5 pm due to severe weather, said District of Columbia police spokesman Dustin Sternbeck. The area near the Lincoln Memorial was not evacuated at the time.

"People are coming from far and wide to join us today and tonight for what is turning out to be one of the biggest celebrations in the history of our Country," Trump tweeted earlier Thursday.

Trump administration officials have refused to say how much taxpayers will have to pay for the expanded celebration on the National Mall this year. The Washington Post reported Tuesday that the National Park Service is diverting almost $2.5 million in fees - primarily intended to improve US parks - to cover some of the costs associated with the event.

Those fees represent just a fraction of the extra costs the government is incurring for the event, which also includes a sizable mobilization of military hardware, and the spending is drawing increased scrutiny from congressional investigators.

Democrats have accused the president of using the Fourth of July celebration for political purposes, and some have publicly decried the display of military might as a reflection of Trump's authoritarian impulses. Aides say Trump first got the idea for a military parade while attending a Bastille Day celebration in Paris in 2017.

Pete Buttigieg, the South Bend, Indiana, mayor who is vying to be the Democratic presidential nominee in 2020, said Thursday that Trump's planned military display was divisive.

"Reducing our nation to tanks and shows of muscle, just makes us look like the loudmouth guy at the bar instead of the extremely diverse and energetic nation that we are," he told reporters in Sioux City, Iowa. "Unfortunately we have one more moment of division at the very date when we are supposed to be celebrating what unifies us."

Trump's defenders view it differently. "The president's simply fulfilling what our Founding Fathers intended for this great nation," Robert Jeffress, a Dallas pastor and evangelical adviser to Trump, said this week on Fox Business Network.

A Bradley Fighting Vehicle is seen as people gather for the "Salute to America" Fourth of July event. (AFP)

In a city where Trump garnered less than 5 percent of the vote in 2016 - and where crowds protesting the day after his inauguration dwarfed his inaugural turnout - Trump will also face demonstrations against his appearance on the National Mall, including a giant inflatable "Baby Trump" set up by the activist group Code Pink.

A 35-minute fireworks show is scheduled for just after 9 pm, according to the Interior Department.

M1 Abrams tanks and Bradley Fighting Vehicles were transported to be in place on the National Mall for the president's speech.

The president's previous attempt to stage a Veterans Day military parade in Washington was thwarted last year after projected costs spiked as high as $92 million.

Trump has pushed back against criticism that the Independence Day program is a waste of taxpayer funds.

Donald Trump and First Lady Melania Trump arrive for the "Salute to America" Fourth of July event. (AFP)

"The cost of our great Salute to America tomorrow will be very little compared to what it is worth," Trump wrote Wednesday on Twitter. "We own the planes, we have the pilots, the airport is right next door (Andrews), all we need is the fuel. We own the tanks and all. Fireworks are donated by two of the greats. Nice!"

In fact, many of the planes and other equipment are based hundreds of miles away from Washington and had to be transported for the Fourth of July event.

Russell Riley, a presidential historian at the University of Virginia's Miller Center, said the president's fascination with the show is reflective of a presidency more concerned with style than substance.

"This is a president who came to the office primarily because he's a showman, and he loves this stuff," he said. "There's almost a childlike joy at being able to move the tanks and the airplanes around on the board."