MADISON, Wis. -

A Madison man with mental health issues who police say purchased an assault rifle and threatened to kill his neighbors and one of his friends made his first appearance in court Wednesday.

Andrew J. Meis, 20, is accused in a plot to kill two Madison residents: a 54-year-old woman and a 21-year-old man.

"The defendant apparently obtained an assault rifle clone recently, specifically for the purpose of killing people," said Dane County Assistant District Attorney Matt Mosier at Meis's bail hearing Wednesday. "He has had some recent outpatient commitments as well as some inpatient psychiatric hospitalization, and there are continuing mental health issues."

Meis is charged with two counts of attempted first-degree intentional homicide.

Meis informed his psychiatrist he was going to kill his neighbors and one of his friends, according to a criminal complaint.

The complaint details a confrontation last December, when police said Meis knocked on a neighbor's door while carrying a gun.

Police said an AK-47 rifle and ammunition were recovered from Meis' home in the 4700 block of Hayes Road. Police said Meis was apprehended before any gun violence took place.

The man who helped sell Meis the firearm spoke with WISC-TV with the condition that his identity be hidden. He said Meis was shopping online for an AK-47 and reached out to the reputable firearms dealer to start the filing of paperwork, background checks and the eventual firearm transfer. The process moved forward legally without any denial or delays.

"So it's a pretty quick process," said the dealer. "It's very tough to make a judgment of someone's character or mental well-being in that short of time."

WISC-TV found that under state law, Meis's mental health history would not have been a red flag on a background check. Only those who have been involuntarily committed and prohibited by court order from possessing firearms would be denied a weapon under state law.

In this case, Meis voluntarily checked himself in for treatment.

"I don't want to be part of a transaction that ends up with something happening," said the firearms dealer. "I'm glad that this got stopped when it did and, from my understanding, he asked for help before acting."

Meis' attorney said her client continues to seek treatment.

"He absolutely is," said defense attorney Amanda Hall. "And I think past records of reaching out for help and reaching out for help in this case absolutely indicates that this is someone who wants to get better, who wants to be a functioning, productive member of society, just like anyone else."

Meis is scheduled to undergo a psychiatric evaluation to determine his competency before his next scheduled court date on Feb. 8. He is currently jailed on a $200,000 cash bond.