With fighter jets soaring above him as he extolled American greatness in a speech at the Lincoln Memorial, President Trump finally got the kind of military celebration he has sought for the past two years.

The Fourth of July extravaganza was created at Trump’s request and designed to suit his whims, but the president largely refrained from using it to praise himself — abandoning his typical self-promotional style to applaud the military and ordinary Americans who have contributed to the nation’s advancement.

“As we gather this evening in the joy of freedom, we remember that all share a truly extraordinary heritage,” Trump said in a 47-minute speech that was dampened and delayed by a downpour on the Mall. “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.”

Trump’s “Salute to America” was clouded in controversy in part amid complaints that the president was inserting himself into a typically nonpolitical event and using a taxpayer-funded celebration of military power to pursue his own partisan objectives. The event featured a VIP section for Republican donors and supporters, and a display of military tanks and aircraft Trump had personally ordered, despite reluctance from some defense officials concerned about politicizing the Pentagon.

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

For months, the president had taken special interest in the event, receiving regular briefings and requesting specific features, from M1 Abrams tanks to Air Force One. When it was over, Trump got the sweeping visuals he might want for 2020 campaign ads in aerial shots of crowds lining the Mall. Shortly after returning to the White House after the speech, the president took to Twitter to attack his critics, decry flag-burning “communists,” and post photos of the crowd size at his speech.

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

During his remarks, Trump introduced the five branches of the U.S. 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 Mall, as a B-2 bomber, F-22 fighter jets and other aircraft filled the sky.

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

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

The president, who has long obsessed over crowd size, highlighted the crowd in several tweets after the event, including one with a picture of thousands of people on the Mall.

“A great crowd of tremendous Patriots this evening, all the way back to the Washington Monument!” he wrote. In several retweets after the speech, Trump highlighted praise of his performance from supporters, including one image morphing his face with Abraham Lincoln’s.

During his remarks, however, Trump steered clear of personal boasting. Instead, he referred to several people in the crowd — an astronaut, a nun, a hurricane volunteer, a 1960s civil rights activist and others — in 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.

A brief reference to Betsy Ross was the closest Trump 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 in defense of the Ross flag in recent days.

Trump administration officials have declined to say how much taxpayers are paying for the expanded celebration on the Mall this year. The Washington Post reported Tuesday that the National Park Service diverted almost $2.5 million in fees — primarily intended to improve U.S. 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, Ind., 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.

Trump, who did not serve in the military and received several deferments to avoid the draft — including with a diagnosis of bone spurs — used the event to pitch military service.

“To young Americans across our country, now is your chance to join our military and make a truly great statement in life,” he said. “And you should do it.”

He also called acting Defense Secretary Mark Esper and Joint Chiefs of Staff Chairman Joseph F. Dunford Jr. to “please join me” onstage, a step some officials feared would be inappropriate.

In a city where Trump garnered less than 5 percent of the vote in 2016, Trump also faced demonstrations against his appearance on the Mall, including a giant inflatable “Baby Trump” set up by the activist group Code Pink.

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.

“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.”

Juliet Eilperin, Josh Dawsey, Laura Hughes and Dan Lamothe contributed to this report.