A student accused of planning a high school shooting bought an AR-15 rifle and 500 rounds of ammunition with money his mother gave him to get a tattoo, police say.

Timothy Felker was arrested in February after he allegedly threatened to shoot classmates at Paul Laurence Dunbar High School in Lexington, Kentucky.

The 18-year-old said he made the threats because he was bullied, but pleaded not guilty to a charge of second-degree terroristic threatening.

During a preliminary court hearing on Monday, Lexington police detective Sean Stafford said Mr Felker “purchased the AR-15 with money that his mum gave him for a tattoo, and that he also purchased 500 rounds of ammunition”.

At the time of his arrest, Mr Felker was not banned from owning guns, and had posted images on social media showing off his AR-15. One of the photos showed him with a gun in his mouth, according to local news channel WKYT.

Police were initially tipped off by a classmate on 16 February. According to court documents, the pupil said Mr Felker “owns a gun and constantly talks about killing himself/shooting up the school. He tells specific people he would shoot them first and then shoot up the classroom”.

Parkland High School survivor David Hogg student movement needs to use their ‘white privilege’ to give voice to minority gun victims

Mr Felker flew out of town on 17 February, and was arrested on his return to Blue Grass Airport on 19 February after police obtained a mental health petition from a court.

He was sent to Eastern State Hospital for an evaluation before being placed under house arrest with an ankle monitor.

“I commend everyone involved, from the students who shared their concerns, to the adults who took those reports seriously and the multiple law enforcement agencies that worked swiftly to safeguard our students and staff,” Fayette County Public Schools Superintendent Manny Caulk said.

Students walk out of US schools to protest gun violence Show all 10 1 /10 Students walk out of US schools to protest gun violence Students walk out of US schools to protest gun violence Young people march from the White House to Capitol Hill while participating in the national school walkout over gun violence. EPA Students walk out of US schools to protest gun violence Thousands of local students march down Pennsylvania Avenue from the White House to the US Capitol during a nationwide student walkout for gun control. AFP/Getty Students walk out of US schools to protest gun violence A student has the words,'don't shoot,' written on her hands as she joins with other students at Marjory Stoneman Douglas High School after walking out of their school to honor the memories of 17 students and teachers that were killed. Getty Students walk out of US schools to protest gun violence Students take part in a walkout at General McLane High School. AP Students walk out of US schools to protest gun violence Students from Harvest Collegiate High School stand in Washington Square Park in New York to take part in a national walkout to protest gun violence. AFP/Getty Students walk out of US schools to protest gun violence Students rally in front of the White House in Washington after walking out of school to protest gun violence in the biggest demonstration yet of the student activism that has emerged in response to last month's massacre of 17 people at Florida's Marjory Stoneman Douglas High School. AP Students walk out of US schools to protest gun violence Airport High School juniors Tony LaFata, 16, left, and Noah Doederlein, 17, stands for a moment of silence during a walkout at General McLane High School. AP Students walk out of US schools to protest gun violence Young people rally on the West Front of the US Capitol to participate in the national school walkout over gun violence, in Washington. EPA Students walk out of US schools to protest gun violence Students from Passaic High School hold photos of some of the 17 victims killed at Marjory Stoneman Douglas High School. AP Students walk out of US schools to protest gun violence Students join hands as they take part in a student walkout in Lafayette. AP

Police said Mr Felker’s mother told them she was unaware of the threats, but that her son suffered from depression, suicidal thoughts and ADHD.

"Ms Felker stated that Timothy does have some anger problems but she could not see him being violent, and didn't feel like he would harm anyone else," Mr Stafford said.