An armed man who was spotted walking around Abington Township, Montgomery County, earlier in the week with an assault rifle strapped to his back was taken into custody by police Thursday.

The unidentified man, who caused an uproar throughout several neighborhoods because of the AR-15 rifle he carried, is undergoing "an involuntary mental health evaluation," Abington police said in a statement.

He has not been charged with a crime, Abington Police Chief Patrick Molloy said, but he is being held for 72 hours while undergoing evaluation. The AR-15 rifle is in the custody of the police department.

Police in Abington held a press conference Friday to discuss the reasons for detaining a young man who was seen earlier in the week walking through neighborhoods with an AR-15 rifle strapped to his back. Friends told police he had threatened to kill himself and “shoot up” Abington High School during the past year.

Police received several reports Monday of a man walking through the area of North Hills, Ardsley, Glenside and the Abington Shopping Center with an AR-15 slung behind his back.

Molloy wrote a letter to residents telling them that while the man’s intentions are unknown, they believe he’s trying to draw officers into a debate over his 2nd amendment right to carry the weapon in public.

“All of our officers are well aware of this passive-aggressive tactic, as they have been videotaped during at least one encounter with him,” Chief Molloy wrote. “While no laws have been broken, this individual’s actions have caused unnecessary alarm to the public, thus diverting valuable police resources from our core mission.”

Molloy had urged residents not to take action or speak with the man and to call 911 if they felt threatened.

In the statement Friday, he again referenced his department's attempts to balance the right to open carry in Pennsylvania, as residents with an open carry permit can do, with the community's safety.

But Molloy also said new information that emerged about the man in recent days led him to have officers take the man into custody.

"This individual’s decision to exercise his rights does not, by itself, warrant an involuntary mental health evaluation," the department statement said. "However, additional information was received which warranted steps to be taken for his safety and the safety of our citizens."

Friends told police that the man bought the AR-15 in March and also purchased a Glock handgun in either February or March.

The friends also told police the man talked in the past year about killing himself and "shooting up" Abington High School, which he had attended until 2017, and Penn State's Abington campus, police said.

A review of the internet search history on the man's smartphone also revealed he spent time researching mass shootings at Parkland High School in Florida, Columbine High School in Colorado and Sandy Hook Elementary in Connecticut, according to court documents.

Some of the searches included "What guns were used in mass shootings," "How many time were AR-15s used in mass shootings," and "How many mass shooters have fatherless homes."

One friend told police they believed the man was throwing up red flags for help.

"I think he is throwing up red flags because he recently dropped out of school. He gave me the impression that he has nothing to lose in a way," the unidentified friend was quoted saying in court documents.

