A man accused of producing a gun at a polling station and threating to "sort" the DUP has refused to tell police where the firearm is, a judge has said.
The district judge rejected Michael O'Hagan's bail application and remanded him in custody, expressing concern that the accused's "unexplained motives and mental state" rendered him a "real and imminent risk".
Judge John Meehan was earlier told that O'Hagan, 59, denies the charges facing him and has no recollection of even being inside the voting centre in the village of Greencastle, Co Tyrone during Thursday's parliamentary by-election for the vacant West Tyrone seat.
He is accused of carrying a firearm with criminal intent and possession of a firearm or ammunition in suspicious circumstances.
A police officer told Dungannon magistrates' court that O'Hagan was arrested at his home a short time after officials at the polling station reported that a man with a "bushy beard, bright yellow jacket and smelling of alcohol" entered the building and pulled out a gun.
Heavily bearded O'Hagan, wearing a grey jumper and green t-shirt, sat impassively in the dock as the detective constable recounted the eyewitness reports.
The accused, from Leaghan Road, between Greencastle and Omagh, only spoke at the outset of the remand hearing to confirm his name.
The police officer said that witnesses inside the polling station at Our Lady Of Lourdes primary school on the Crockanboy Road claim the man with the gun threatened to take action against unionists.
She said he allegedly stated: "Where is the DUP, is there unionists here, there will be no DUP here.
"There better be no DUP in here or I will sort them."
The officer said the man in the polling station had not disclosed his name before leaving, but she said local people in the building at the time identified him as O'Hagan.
She said when detained by officers at his house, O'Hagan told police he had "no memory of being at the polling station", explaining that he had been "drinking heavily for the previous three days".
The detective constable, who said she could connect O'Hagan to the charges, told the court that no gun had been located.
"Searches are ongoing for the firearm," she said.
Objecting to bail, the officer claimed: "He's the only person who knows where the firearm is, so if he's not remanded he may go and get the firearm."
Judge Meehan questioned an assertion from O'Hagan's defence solicitor that he co-operated during police custody interviews, pointing out that when asked by detectives where the gun was he said: "I'm not telling you".
Mr Meehan described the alleged offence as "very serious".
The accused's lawyer said his client had an "alcohol problem", insisting: "there is nothing in his background to suggest he has a predilection for this type of behaviour".
He asked the detective constable to confirm that there was no evidence that he was involved in dissident republican activity.
She said there was no evidence of any links to a dissident organisation.
But she added: "No dissident activity, but he is alleged to have made his political views quite clear during the incident."
Judge Meehan remanded O'Hagan in custody to appear, via videolink, at Omagh magistrates' court on May 29.