
Melaka acting police chief Nazri Zawawi said the 25-year-old man was detained at a house in Tangga Batu at 12.40am today, Bernama reported.
He said on Tuesday, at 10.10pm, the suspect rode to the police station on a motorcycle belonging to his younger sister.
He stopped outside the police station, threw the hammer and then headed to Pantai Puteri.
Two officers were on duty at the complaints counter at the time but were not injured.
Nazri said the suspect later confessed to the act, saying he was angry and claimed hearing voices urging him to do so.
The suspect tested negative for drugs.
He has been remanded for four days and the case is being investigated for causing mischief and criminal intimidation under the Penal Code as well as the Protected Areas and Protected Places Act 1959.