Donald Trump. Carlos Barria/Reuters

The Boy Scouts of America sought to distance itself Tuesday from President Donald Trump's highly political speech to tens of thousands of Scouts, after parents criticized the speech and the organization.

In the statement, the organization said it was "wholly nonpartisan" and did not endorse "any political party of specific policies."

"The Boy Scouts of America is wholly nonpartisan and does not promote any one position, product, service, political candidate, or philosophy," the statement said. "The invitation for the sitting US president to visit the National Jamboree is a long-standing tradition and is in no way an endorsement of any political party or specific policies.

"The sitting US president serves at the BSA's honorary president," it continued. "It is our long-standing custom to invite the US president to the National Jamboree."

The speech Trump delivered to the group of more than 40,000 Boy Scouts was one of his most freewheeling in months. He began it by saying, "Who the hell wants to speak about politics when I’m in front of the Boy Scouts, right?" But over the next 40 minutes, he did exactly that.

"You know, I go to Washington and I see all these politicians, and I see the swamp," he said. "And it’s not a good place. In fact today I said we ought to change it from the word swamp to the word cesspool or, perhaps, to the word sewer. But it’s not good. Not good. And I see what’s going on, and believe me I’d much rather be with you. That I can tell you."

He subsequently joked that he would fire Health and Human Services Secretary Tom Price if the Senate could not pass healthcare legislation, ripped on the "fake media," and discussed his electoral victory while blasting Democratic presidential nominee Hillary Clinton.

"Do you remember that famous night on television, November 8, where they said — these dishonest people — where they said there is no path to victory for Donald Trump?" Trump said. "They forgot about the forgotten people. By the way, they're not forgetting about the forgotten people anymore. They're going crazy trying to figure it out. But I told them, far too late. It’s far too late. But do you remember that incredible night with the maps and the Republicans are red and the Democrats are blue, and that map was so red, it was unbelievable, and they didn't know what to say?"

The boisterous crowd of young scouts responded with applause.

"And you know we have a tremendous disadvantage in the Electoral College — popular vote is much easier," he continued. "Because New York, California, Illinois — you have to practically run the East Coast. And we did. We won Florida. We won South Carolina. We won North Carolina. We won Pennsylvania. We won and won. So when they said, there is no way to victory, there is no way to 270. I went to Maine four times because it’s one vote, and we won. But we won — one vote. I went there because I kept hearing we're at 269. But then Wisconsin came in. Many, many years — Michigan came in. And we worked hard there. My opponent didn't work hard there because she was told--"

The crowd booed at the mention of Clinton. Trump then transitioned to blasting polls as "fake news" and "fake polls."

"So I have to tell you what we did, in all fairness, is an unbelievable tribute to you and all of the other millions and millions of people that came out and voted for Make America Great Again," he said to chants of "USA! USA! USA!" "And I’ll tell you what, we are, indeed, making America great again. What’s going on is incredible."