TORONTO -- Officers faced with a potentially lethal threat frequently have just seconds to decide whether to use deadly force, the murder trial of a Toronto officer accused of gunning down a knife-wielding teenager heard Friday.

As a result, court heard, it's not always possible for an officer to consider all aspects of the situation before opening fire, defence lawyer Peter Brauti said.

"We're not looking at a standard of perfection," Brauti suggested.

"You might have to make a split-second decision. All we really expect is that an officer make that decision in good faith."

Toronto Deputy Chief Michael Federico, under cross-examination on the stand, agreed with Brauti.

The lawyer also got Federico to agree that an officer's perception of how dangerous a situation might be is considered important based on use-of-force guidelines under which police operate.

Earlier in the day, Federico testified that police are legally allowed to use deadly force -- but only if it's both reasonable and necessary.

The legal precepts are at the heart of the case against Const. James Forcillo, who shot Sammy Yatim dead on an empty streetcar in July 2013.

Federico, a use-of-force expert, said officers are taught that the Criminal Code mandates that use of lethal force must be objectively reasonable to preserve life or prevent serious injury.

An officer, he said, must also use the minimal force required to neutralize a threat.

"The ultimate objective is always to have the safest possible outcome," Federico said.

Officers are under tremendous obligations and pressures in situations that can change quickly, Federico said.

Training involves role-playing in likely scenarios but there is no one-size-fits-all approach, he said. Instead, officers are taught to consider the entirety of the circumstances when deciding on force options.

Forcillo has pleaded not guilty to second-degree murder and attempted murder for firing nine shots at Yatim in two volleys -- eight of which struck the teen, who had forced other passengers off the streetcar but not hurt anyone.

In general, resorting to a firearm should be an officer's last choice, court heard, and occurs in three distinct phases: drawing the gun, pointing it at a subject, and, finally, firing.

Court has seen multiple videos of the incident and heard how Forcillo drew his gun and ordered Yatim to drop the knife in what is called the "police challenge" but the teen did not comply.

Federico, who court heard won't be offering an opinion on Forcillo's conduct, said the "police challenge" occurs when an officer says, "Police! Don't move!" or "Police! Drop the knife!"

"Our research has shown clear, unequivocal instructions have the best effect," Federico said.

Officers are trained to assess whether someone has in fact heard and processed the challenge, court heard.

Police should always try to de-escalate a situation -- get someone to stop whatever they are doing and follow instructions -- preferably by talking to them, the officer said. Effective verbal communication is especially important when dealing with people in crisis, court heard.

If a person is not complying, Federico said, an officer needs to re-evaluate the approach and see if something else might be more effective.

Federico testified about the importance of distance between an officer and a potentially threatening individual, especially one with a knife, which he called "extremely dangerous."

"Distance creates time. Time creates options and opportunities," Federico told prosecutor Milan Rupic. "The further away you are, the safer both people are."

The trial continues Monday with evidence expected from a pathologist. Examination of Federico will continue after that.