President Donald Trump signed a sweeping executive order Wednesday authorizing U.S. sanctions on any foreign individual or country that tries to interfere in U.S. elections.

“This is intended to be a very broad effort to prevent foreign manipulation of the political process,” John Bolton, Trump’s national security adviser, told reporters during a briefing Wednesday, according to USA Today.

The move comes less than two months before the 2018 midterm elections, and just weeks after Dan Coats, Trump's director of national intelligence, warned of a "pervasive messaging campaign by Russia to try to weaken and divide the United States" before Americans go to the polls in November.

“We are doing everything we possibly can, first of all to prevent any interference with our election, and then to do a full assessment after the election,” Coats said Wednesday.

Read alsoRussia, West show war games aren’t just games: ex-NATO chief

The forceful rhetoric stands in sharp contrast to Trump's own statements about Russia's efforts to undermine American democracy. Trump has called the federal investigation into Russia's role in the 2016 presidential election a "witch hunt."

And after a closed-door meeting with Russian President Vladimir Putin in July, Trump said he believed Putin when he denied that Russia did not try to sway the 2016 election, despite the U.S. intelligence community's public findings implicating the Kremlin.

Bolton denied that Wednesday's executive order was an effort to reverse the damage from Trump's remarks after the summit with Putin, which prompted outrage among lawmakers in both parties.

"The president has said repeatedly that he is determined that there not be foreign interference in our elections," Bolton told reporters. "I think his actions speak for themselves."

Coats said the new executive order is a response to Russia's actions in the 2016 election and "to make sure that doesn’t happen again. But he said the order will apply not just to Russia but to others possible bad actors, including China, North Korea, and Iran.

Read alsoU.S. Army beefs up its footprint in Germany - media

The order sets up a high-level process for the U.S. intelligence community and other law enforcement officials to investigate and evaluate possible election meddling.

First, it requires the Director of National Intelligence to conduct regular assessments of possible election interference. And after each election, the intelligence community will have 45 days to investigate whether there was an attempt at interference, followed by a Justice Department review.

If there is consensus that a foreign country or other entity tried to meddle in the election, automatic sanctions would be triggered, Coats said.

Bolton said the sanctions would be imposed not just for direct actions, such as hacking into election systems, but also for distribution of propaganda and disinformation. Russia spent millions of dollars trying to sow division and discord in the 2016 presidential race, using Facebook and other social media platforms, among other tactics.