Former president Barack Obama has criticised Donald Trump’s tenure in office in fiery speeches in Milwaukee and Detroit that took aim at him and other Republicans for “making stuff up”.

The speeches were among Mr Obama’s sharpest and most direct takedowns of Mr Trump’s presidency, although the former president was careful to not mention Mr Trump by name.

He said the “character of our country is on the ballot” in the first midterm election since Mr Trump took office.

Mr Obama cited a recent Mr Trump comment that he would pass a tax cut before the November election. Mr Obama then told the crowds in high school gymnasiums that “Congress isn’t even in session before the election! He just makes it up!”

At one point Mr Obama said in Wisconsin: “Here’s the thing. Everything I say you can look up.”

Mr Obama’s visits were to urge people to vote for Michigan and Wisconsin’s Democratic candidates.

Election 2018
Former President Barack Obama speaks during a rally in Detroit (Paul Sancya/AP)

While Mr Trump was frequently the target of his criticism, he did not spare Republicans generally and said they are lying when they say they want to protect people with pre-existing conditions while trying to repeal the Affordable Care Act.

“What we have not seen before in our public life is politicians just blatantly, repeatedly, baldly, shamelessly, lying. Just making stuff up,” Mr Obama said.

“Calling up, down. Calling black, white. That’s what your governor is doing with these ads, just making stuff up,” he said, referring to Wisconsin Republican governor Scott Walker and his assertions that he wants to protect health care for those with pre-existing conditions.

Mr Walker is being challenged by Democrat Tony Evers.

In Michigan, Mr Obama credited Democrat governor candidate Gretchen Whitmer for helping to expand Medicaid and said “few people fought against it harder” than her Republican opponent, state Attorney General Bill Schuette.

He said voters can trust Senator Debbie Stabenow to protect people with pre-existing conditions because “she was there” to help pass his health law. She is facing a challenge from Republican John James, whom Mr Obama criticised for saying he backs Mr Trump’s agenda “2,000 per cent.”

Mr Obama used the subject of Hillary Clinton’s private email server to accuse Republicans of trying to “scare the heck out of people before every election” and also to mock Mr Trump about the Chinese spying on his mobile phone.

Election 2018 Obama
Senator Debbie Stabenow, Barack Obama and Gretchen Whitmer appear during a rally in Detroit (Paul Sancya/AP)

“In the last election, it was Hillary’s emails. ‘This is terrible’ … ‘This is a national security crisis.’ They didn’t care about emails and you know how you know? Because if they did, they’d be up in arms right now that the Chinese are listening to the president’s iPhone that he leaves in his golf cart.”

Mr Obama spoke about the slow-moving migrant caravan from Central American bound for the United States as another example of a Republican scare tactic.

“Now the latest, they’re trying to convince everybody to be afraid of a bunch of impoverished, malnourished refugees a thousand miles away,” he said.

“That’s the thing that is the most important thing in this election,” he said.

“Not health care, not whether or not folks are able to retire, doing something about higher wages, rebuilding our roads and bridges and putting people back to work.”

“Suddenly,” he continued, changing his voice to a high-pitch to strike a mocking tone, “it’s these group of folks. We don’t even know where they are. They’re right down there.”

Referring to Mr Trump’s promise to “drain the swamp,” Mr Obama said that instead “they have gone to Washington and just plundered away.”

“In Washington they have racked up enough indictments to field a football team,” he said. “Nobody in my administration got indicted.”

Mr Obama’s visit to Milwaukee was the first time he was in the city for a political event since March 2016, when he came to celebrate enrolment numbers in the Affordable Care Act. He did not campaign for Hillary Clinton in Wisconsin, a state she narrowly lost that proved crucial to Mr Trump becoming president.

Michigan is another battleground state in the Midwest that Democrats lost in 2016, despite Mr Obama’s visit the day before the election.

“I’m hopeful Michigan,” he said. “I’m hopeful that despite all the noise, despite all the lies, we’re going to come through all that. We’re going to remember who we are, who we’re called to be. I’m hopeful because out of this political darkness, I’m seeing a great awakening.”