A teenage terror suspect who was seen waving an Islamic State flag has been shot dead after stabbing two Australian police officers.

Abdul Numan Haider, 18, an Australian citizen of Afghan origin, was asked to attend a police station in Melbourne yesterday to be interviewed by anti-terror officers when the attack happened.

Victoria Police Chief Commissioner Ken Lay, said one of the officers tried to shake hands with Haider when he was stabbed in the arm. The second officer was then stabbed several times in the head and body. The first officer then shot and killed Haider. Both officers required surgery, but were reported to be in a stable condition.

Haider came to the attention of the authorities three months ago after he was seen waving what appeared to be an Islamic State (IS also known as Isil) flag at a shopping centre.

Australian Federal Police acting commissioner Andrew Colvin said the man’s passport was cancelled about a week ago on national security grounds.

“Our members had no inkling that this individual posed a threat to them and as far as we were concerned, it was going to be an amicable discussion about that individual’s behaviour,” Assistant commissioner Luke Cornelius of Victoria state police said, adding that the officer had “no choice” but to shoot.

It appeared the man was acting on his own and that the violence was an isolated incident, Mr Cornelius added.

Police said it was not yet clear whether reports that the man had threatened prime minister Tony Abbott before he was shot were true, but the man had not made any “specific threats”.

Mr Abbott, on his way to New York to attend a United Nations Security Council meeting on the problem of 15,000 foreign fighters in Iraq and Syria, said: “Obviously this indicates that there are people in our community who are capable of very extreme acts.”

Earlier this month, Australia raised its terror warning to the second-highest level. Last week police detained 16 people in counter-terrorism raids in Sydney and charged one with conspiring with an IS movement leader in Syria to kidnap and behead a randomly-selected person.

The government is currently proposing a law making it illegal to visit terrorism hotspots abroad.