Onlookers at the Perth District Court were bemused when a goat wearing a hat walked up the court stairs this morning.

Gary the goat was on a morning walk with his owner, comedian James 'Jimbo' Bazoobi.

It was not Gary's first court appearance.

Earlier this year Mr Bazoobi was fined for allowing Gary to eat flowers from a garden bed outside the Museum of Contemporary Art at Sydney's Circular Quay.

The fine was later overturned.