A 17-year-old stands charged with two felonies for allegedly posting online a video of himself displaying a gun outside Edina High School and making a threat.

Nasrudin Abdirashad Warsame is charged in Hennepin County Juvenile Court with felony charges of gun possession and threats of violence, according to a petition filed Monday following his arrest Friday. Warsame is accused of posting the video Thursday night while outside the school's main entrance and displaying a handgun with an extended magazine. The video's caption said "come outside [expletive]." It forced the high school and middle school to shift to virtual instruction Friday.

According to the statement of probable cause:

The FBI's national threat operation and analysis crisis team received information from Snapchat regarding "a potential school shooting threat at Edina High School."

"Specifically, the video begins by showing a black handgun in the lap of a front seat passenger of an unknown vehicle. After the video captures the handgun on the lap of the subject wearing "Glock" sweatpants, the video pans to the front entrance of Edina High School ... A review of video surveillance at Edina High School from September 14 revealed a dark sedan parked in the location (directly outside main entrance) where the video is believed to be recorded."

A phone number and email connected to the Snapchat account led to Warsame and his parents' apartment on Franklin Avenue S. in Minneapolis. Detectives obtained a search warrant and immediately went to the apartment, where they found clothing matching those shown in the video and the cellphone used. They arrested Warsame.

Detectives also met with apartment management to review surveillance video that showed Warsame wearing the same clothing Thursday night that was shown in the Snapchat video.

At Hennepin County Juvenile Detention Center (JDC), Warsame is accused on having one round of 9mm ammunition in the right rear zipped pocket of the sweatpants.

In an interview, he allegedly said that he only wanted to say that his Snapchat was hacked before invoking his right to remain silent.

He faces two felony counts: Possession of ammunition and a semiautomatic military-style assault weapon while being under the age of 18; threats of violence, reckless disregard of risk, which accuses him of threatening to commit a crime of violence with the purpose of terrorizing another or reckless disregard of the risk of causing terror in another.

Police said Warsame is neither a current nor a former Edina High School student.