A homeless Polish man found with an imitation gun in Ballymena claimed he had it to scare people after being told the town "was not a great area for foreign nationals".
A passer-by in a vehicle was concerned after spotting Marcin Fialek (30), of no fixed abode in Ballymena, sitting at Albert Place in the town centre whilst "staring" at a 'gun', the barrel of which was in his right hand, on July 10 this year.
Police were called on 999 and when they found the defendant a short distance away at Greenmount Terrace as well as the 'gun' he also had three knives in a backpack.
At Ballymena Magistrates' Court, sitting in Antrim, on Thursday, the defendant appeared via a video link from prison and pleaded guilty to charges of carrying an imitation firearm and possessing knives in public.
The prosecutor said when interviewed the defendant said the 'gun' "wasn't real and it didn't fire bullets".
The defendant told police the weapon "made a noise" and he had it for "self-defence to scare people if he was attacked".
Fialek told police the knives were locked in a lockbox in his backpack in which he was carrying his belongings after being "asked to leave his property".
Defence barrister Stephen Law said the defendant was "homeless" at the time.
He said Fialek had been working in the Ballymena and been here since 2018 and "and sent all his earnings back to his family in Poland".
The lawyer added: "He was listening to people in the community, Polish, who were telling him that Ballymena was not a great area for foreign nationals."
The defence barrister said whilst still working Fialek hoped he could get emergency accommodation "and he had this air pistol for his own self-protection, it made him feel safer."
Mr Law added: "He didn't realise the significance, particularly in Northern Ireland, of having an air pistol, looking at it, and sitting on a bench, but he does now."
The lawyer said bail had previously been granted but the defendant had nowhere to go to and had already spent four months in custody on remand.
Mr Law said the defendant was keen to get out of jail and either return to Poland or re-engage with his employers.
District Judge Nigel Broderick said: "It is a serious matter given the fact that it would have not just caused distress to anyone who saw him but these items could have fallen into the wrong hands as well."
The defendant was given a five months prison sentence.