Updated

The college student was being held in a headlock by a masked intruder with a loaded gun to her head. Then the gunman took aim at an officer.

A moment later, both Hofstra University junior Andrea Rebello and the intruder were dead — killed after a split-second decision that is perhaps the most harrowing in law enforcement: when to pull the trigger.

The unfortunate Nassau County cop has been identified by The New York Post as Officer Nikolas Budimlic, 42, who is “inconsolable” after the home invasion standoff.

“He blames himself and keeps replaying it in his mind,” a police source told the Post. “He is torn up about the poor girl.” Budimlic is a former NYPD cop with two young kids of his own, including a daughter.

"The big question is, how do you know, when someone's pointing a gun at you, whether you should keep talking to them, or shoot?" said Michele Galietta, a professor of psychology at the John Jay College of Criminal Justice who helps train police officers. "That's what makes the job of an officer amazingly difficult."

More On This...

She spoke Sunday as Hofstra University students honored Rebello, a popular 21-year-old public relations major, by wearing white ribbons at their graduation ceremony.

Rebello's funeral is scheduled for Wednesday in Sleepy Hollow, north of New York City.

The news that she died from a police bullet came as "a second shock" for the already devastated family, said Henry Santos, Rebello's godfather.

Her life ended in the seconds that forced the veteran police officer to make a fatal decision, but the questions surrounding the student's death are just beginning, along with an internal investigation by the Nassau County Police Department.

Rebello and the intruder, Dalton Smith, died early Friday when the officer fired eight shots, hitting him seven times and her once in the head, according to county homicide squad Lt. John Azzata.

With a gun pointed at her, Smith "kept saying, 'I'm going to kill her,' and then he pointed the gun at the police officer," according to Azzata.

The officer acted quickly, saying later that he believed his and Rebello's lives were in danger, according to authorities.

No doubt, he was acting to try to save lives — his own and that of the young woman, Galietta said.

"What we're asking the cop to anticipate is, 'What is going on in the suspect's mind at the moment?'" she said. "We're always trying to de-escalate, to contain a situation, but the issue of safety comes in first, and that's the evaluation the officer has to make."

Eugene O'Donnell, a former New York City police officer and professor of law and police studies at John Jay College, said the crucial issue may be whether or not police had deemed it a hostage situation. If so, he said, there are protocols police follow to buy time, slow down, isolate and assess.

But O'Donnell said the officers may have had few options because of "an eyeball to eyeball confrontation between the officer and the offender."

"It may have been too fluid to deteriorate for the officers to do anything else," O'Donnell said. "It underscores that there's no two of these that are exactly alike."

Police tactical manuals are meant to assist officers in making the best decision possible, but in the end, "they're not 100 percent foolproof," Galietta said. "In a situation like that, you can follow procedure, and it doesn't mean it comes out perfectly."

Hofstra student John Kourtessis told the New York Post that he'd gone to a bar with Rebello and a few other friends to celebrate the end of school. When they got back to Rebello's house, she asked him to move his car and he went upstairs to get his keys.

When he came back down, he said, Smith was there. He said Smith kept talking about "the Russian guy," insisting the house's residents owed a Russian man money and that he was outside waiting.

"He was saying ... that he just needed us to cooperate. I said, 'Listen, we have all this money here.'"

Kourtessis said the students offered Smith computers, jewelry and other items from the house but that Smith kept demanding more money.

The officer who fired the shots is an eight-year NYPD veteran and has been with Nassau County police for 12 years.

He is now out on sick leave, Azzata said.

Procedurally, the Nassau County district attorney would determine whether an officer's use of deadly force was justified, O'Donnell said. A spokesman for the prosecutor's office said Monday it is monitoring the ongoing police investigation.

Based on reporting by The Associated Press.

Follow us on twitter.com/foxnewslatino
Like us at facebook.com/foxnewslatino