San Juan County Sheriff's Office detectives had tried for days to speak with Byron Bradford Boyd, 39, as part of their investigation, Lt. Brice Current said.
Boyd, who was on probation, removed his ankle monitor weeks ago and was hiding out at Josh Leeper's house, on County Road 2900, Current said.
Boyd missed a meeting with his probation officer on Dec. 17.
"He knew that law enforcement was looking for him," Current said. "And his thought was: I'm not going to go back to jail.'"
Deputies arrived at Leeper's property near Aztec early Monday afternoon and Boyd barricaded himself into a cement building and fired shots at officers.
The situation ended when Boyd shot himself in the head, sheriff's office spokeswoman Beth Utley said.
Boyd was required to wear the monitoring bracelet because he was on probation for a 2006 sex crime in Albuquerque.
He pleaded guilty to rape in Albuquerque District Court in 2009, according to a state court website.
Current said deputies and investigators tried to end Monday's standoff peacefully, despite the fact Boyd was shooting at law enforcement.
"They exhausted a lot of means of less lethal force even though the parameters to use deadly force were there," he said.
A deputy who worked to secure the scene was hospitalized because of hypothermia on Monday. He was the only law officer injured.
Sheriff Ken Christesen issued a statement shortly after the incident. He said Boyd's death was tragic.
"This is a tragedy for everyone. For his family, for us," he said. "There is nothing worth ending your life over."
Leeper, 37, was arrested late Christmas Eve. He was charged with harboring a fugitive, a fourth-degree felony, and assaulting a police officer, a misdemeanor.
Leeper and Boyd were friends and Leeper knew that Boyd was a fugitive, Current said.
While detectives were on Leeper's property investigating, he started to yell and he threatened a sheriff's office sergeant, which is why he was charged with assault, according to court documents.
Leeper was released from the jail early Christmas morning after paying a portion of his $5,600 bond. He is scheduled to have a preliminary hearing Jan. 13.