MELBOURNE, Australia — The Australian authorities are treating an abduction and a killing here in Melbourne on Monday, which ended with the gunman dead, as a terrorist attack.

The police killed the gunman after he held a woman hostage at an apartment complex in Brighton, one of Melbourne’s wealthiest suburbs. The woman was rescued, and another man was found dead in the lobby, the police said. The authorities did not immediately identify the victims.

The police identified the gunman as Yacqub Khayre, an Australian citizen with a long criminal record who came to the country from Somalia as a child refugee. Graham Ashton, the chief police commissioner for Victoria State, said Mr. Khayre was known to the police “for a whole range of offending,” including drug and violent crimes and arson.