A man was “leaned upon” to store a 9mm semi-automatic pistol and 13 rounds of ammunition due to a €5,000 drugs debt, a court has been told.