A 27-year-old Anchorage man was sentenced on Friday to serve seven years in prison for threatening police officers with a handgun during a 2014 confrontation that led to an hours-long standoff.

Eric Nebreja pleaded guilty in August of 2015 to four charges in the case — two counts of third-degree assault and a single count each of fourth-degree misconduct involving a controlled substance and tampering with physical evidence.

The charges stemmed from a confrontation between two Anchorage police officers and Nebreja on Oct. 9, 2014. Nebreja was at the Mountain View Drive Shell gas station when the officers saw his vehicle and recognized it as one that had eluded police earlier that week, according to a statement from the Attorney General’s office.

A witness at the scene said Nebreja was leaving the gas station when he “saw something he didn’t like” and backed up, hitting another vehicle in the parking lot. A police vehicle blocked him from leaving, and Nebreja reportedly fled his vehicle on foot. An officer used a Taser on Nebreja, but he was able to keep going and pointed a gun at the two responding officers, threatening to shoot them or himself.

He fled and broke into an apartment on Flower Street, where he barricaded himself inside, according to the AG’s office. After several hours and tear gas deployment, he was taken into custody and transported to a hospital for treatment of tear gas inhalation and other injuries, police said. They noted he attempted to hide a gun in a box of rice and a gun magazine in the apartment’s refrigerator before his arrest.

During sentencing, Superior Court Judge Jack Smith called each charge the “worst offense,” the AG’s office said. He gave Nebreja the maximum sentence for each assault charge to isolate him from the public for their protection. During the standoff, police evacuated the area and put nearby schools on lockdown.

“If even one person hears about this sentence and decides not to act this way, that’s a good thing,” he said.

Nebreja was also convicted on a federal charge of a felon possessing a firearm in connection to the case, but has not yet been sentenced, according to the AG’s office.