A solicitor told Derry Magistrate's Court that his client had 'a bad day' after a visit to the dentist was followed by a fire near his flat and then an arrest for drugs and public order offences.
Sean Kelly (49) from Marlborough Street in the city admitted a series of offences that occurred on April 5.
The court heard that a fire broke out in a building where Kelly had a flat.
While they were investigating the fire police came across a cannabis cultivation facility in a wardrobe in Kelly's flat.
The floor of the wardrobe had been lined in tinfoil, and light bulbs rigged up above and there were seven cannabis plants although there were no leaves on them.
While police were investigating Kelly arrived back and told police they had no right to keep him out of his own flat.
Kelly struggled with police and shouted at bystanders to witness what was happening.
In the police vehicle he tried to headbutt an officer and had to be manhandled put of the vehicle.
He then headbutted a wall and then the tarmac on the ground and shouted 'I'll blame this on you lot see how smart you are then.'
Defence solicitor Mr. Seamus Quigley said at least there had been no physical contact made and added that his client had not been having a good day after having to have an abscess treated before the fire in his building.
Kelly was fined a total of £450.