A man from New York state who is accused of shooting a UPS driver dead outside a Walmart has told a court he killed Donald Trump.

Justin Barkley, 38, from Ithaca claimed he knew where the president-elect would be on December 8.

He told the judge he then waited outside of the store where he shot a man he believed to be the billionaire - however he actually fired at 52-year-old William Schumacher.

'I shot and killed Donald Trump purposely, intentionally and very proudly,' Barkley said during his arraignment on Monday, according to the Ithaca Voice.

Justin Barkley, 38, (left) is accused of of killing UPS driver William Schumacher, 52, (right) in Ithaca, New York. Barkley told a judge he killed Donald Trump during a court appearance

Police engaged Barkley in an eight-hour standoff before they arrested him after shooting Schumacher and firing at other officers.

Barkley was indicted for second-degree murder and menacing a police officer.

In a court hearing that appeared to make very little sense at times, Barkley told Judge John Rowley that 'he recognized the difference between mistaking a person for Trump and saying that he killed him.'

UPS driver William Schumacher was shot outside of a Walmart after Barkley claims he thought he was Donald Trump

UPS held a tribute for their fallen worker

The Daily News reports how Barkley was asked whether any evidence suggested that a person he killed was not Trump, to which he answered, 'I hope not.'

Judge Rowley refused to allow Barkley to enter a guilty plea stating that Barkley needed to be examined by psychiatrists to determine whether he is even capable of standing trial. That would last until February. next year.

The judge said that he felt 'uncomfortable' taking Barkley's plea without having undergone psychiatric examinations first.

The assessment could take place at either a mental hospital or at the jail itself.