He later admitted he wanted to go to his ex-partner's house "to see if any other guys had been visiting her", Mr Butler said.
He pleaded guilty to possessing an offensive weapon.
Defence lawyer Anna Brosnahan said it was O'Leary's first offence for possessing an offensive weapon.
"There's been a recent breakdown in a relationship, everything seems to be in control at this stage, sir, and they are going about things in the correct way now.
"I don't know what he was going to do when he got there, sir. I don't know how that was going to assist him at all and neither does he."
Ms Brosnahan suggested an order to come up for sentence if called upon, so it would "hang over his head" as the relationship was "sorting itself out".
Judge Dugald Matheson ordered O'Leary to come up for sentence if called upon within nine months and also ordered the destruction of the axe handle.