Gardaí responded to an alert at the Clayton Hotel in Clonshaugh just after 9am on Friday.
Minutes later in the vicinity, they arrested Karl McDermott (24), of The Beeches, Clonshaugh Woods. He was charged with attempted robbery of the hotel, and robbery of a Circle K garage at 7.45am that morning.
He appeared before Judge Marie Quirke at the weekend sittings of Dublin District Court. She heard he made no reply when charged.
Garda Linda Woods objected to bail because of the seriousness of the incidents.
She told the court gardaí responded to a panic alarm at the garage and were informed a male entered, "produced a knife and threatened a staff member".
The court heard the raider demanded the contents of the till.
However, it could not be opened, and the man fled with four bottles of wine.
Later that morning, gardaí received a report about a man armed with a knife at the Clayton Hotel. He entered the lobby and approached a male customer at the reception desk.
The bail hearing was told the raider put his arm around the customer’s neck and placed a knife to him.
However, the man managed to free himself, but then the accused allegedly waved the knife at three terrified female staff members who ran and locked themselves in an office.
He fled empty-handed, there was CCTV evidence, and the accused was arrested near the hotel minutes later. Gardaí also recovered a knife.
Mr McDermott did not answer when gardaí questioned him about the incidents.
Gda Woods agreed with defence solicitor Simon Fleming that there were no issues with him after his arrest, and he caused no difficulties during his detention.
She accepted he made no admissions, exercised his right to silence, and no injuries were suffered during the two incidents.
Pleading for bail, Mr Fleming said the defendant's partner offered to stand €2,000 bail, a substantial amount for Mr McDermott and his family.
He submitted that the accused could sign on regularly at a garda station, remain contactable by phone and obey a curfew.
The solicitor proposed that his client resides at his partner's home, a good distance from the garage and the hotel.
The court heard there were mental health concerns for Mr McDermott, whose brother died tragically in prison.
Judge Quirke refused bail and remanded him in custody to appear at Cloverhill District Court next Tuesday. She agreed to direct medical attention for him in prison.
He has not yet indicated how he will plead and was granted legal aid after the court heard he was unemployed.