US president Barack Obama has hit out at GOP nominee Donald Trump over accusations the upcoming election is rigged, telling him to stop whining.

Obama, whose two terms as president will officially come to an end in January, was speaking at a press conference with Italian prime minister Matteo Renzi on 18 October when he addressed Trumps claims.

Id invite Mr Trump to stop whining and go try to make his case to win votes, Obama said in comments carried by The Hill.

He added: I have never seen in my lifetime, or in modern political history, any presidential candidate trying to discredit the elections and the election process before votes have even taken place.

Its unprecedented. It happens to be based on no facts.

Trump had said the November polls would not be fair, referencing research from 2012 by Pew Trusts, which suggested 24 million voter registrations were not accurate and the system needed to be upgraded.

They even want to try to rig the election at the polling place, Trump said at a rally in Green Bay, Wisconsin, Reuters reported. So many cities are corrupt and voter fraud is very, very common.

However his comments were also disputed by Republican campaign lawyer Chris Ashby, who told the news service: When you say an election is rigged, youre telling voters, your supporters, their votes do not matter. I think some of Donald Trumps comments could cause unrest at the polls.

Obama also suggested Trump was making the claims because he knew he was losing support.

That is both irresponsible and, by the way, doesnt really show the kind of leadership and toughness you want out of a president, Obama added at the press conference.

You start whining before the game is even over? If whenever things are going badly for you and you lose, you start blaming someone else, then you dont have what it takes to be in this job.