President Obama has barred huge groups of potentially dangerous immigrants from entering the United States at least six times, undercutting his claim that barring Muslims from terrorist countries as Donald Trump has proposed is un-American.

In his first ban, according to a search of White House records, Obama instituted a ban on "immigrants or nonimmigrants" covered by a larger United Nations travel ban. He also included those on an economic sanctions list. Most countries were Muslim.

He cited the very same section of law that many critics of his policies have asked him to use, "section 212(f) of the Immigration and Nationality Act of 1952." It says, "Whenever the president finds that the entry of aliens or of any class of aliens into the United States would be detrimental to the interests of the United States, the president may, by proclamation, and for such period as he shall deem necessary, suspend the entry of all aliens or any class of aliens as immigrants or non-immigrant's or impose on the entry of aliens any restrictions he may deem to be appropriate."

He used the same provision five other times, one more in 2011, twice in 2012 and twice in 2014. In those, he targeted people aiding Iran, Syria, Crimea, and those involved in war crimes.

Still, in his latest tirade against Trump's call for a ban on Muslims from terror nations, Obama said such bans violate the American way.

In reaction to the Orlando terror attack, Trump said, "When I'm elected, I will suspend immigration from areas of the world where there is a proven history of terrorism against the United States, Europe or our allies until we fully understand how to end these threats."

Obama ripped him. "That's not the America we want," he said. "It doesn't reflect our democratic ideals. It will make us less safe."

White House documents also show that former President Bill Clinton issued six immigrant bans; George W. Bush six immigrant bans; and former President Ronald Reagan four. And in 1980, former President Jimmy Carter banned Iranians after Tehran seized the U.S. embassy.

Below are Obama's actions:

— July 25, 2011. Barred those under a UN travel ban, or who broke 29 executive orders covering transactions with terrorists.

— Aug. 4, 2012. Banned anybody involved in war crimes, or just about any other crime including human rights violations.

— April 23, 2012. Barred those helping Syria or Iran, or involved in human rights abuses for those governments.

— May 1, 2012. Another block on those helping Iran and Syria.

— April 3, 2014. Banned anyone known to threaten South Sudan.

— March 6, 2014 . Barred entry of those claiming government authority in the Crimea region of Ukraine, presumably on behalf of Moscow.

Paul Bedard, the Washington Examiner's "Washington Secrets" columnist, can be contacted at pbedard@washingtonexaminer.com