MADISON, Wis. — A California judge ordered a man to surrender his guns and ammunition after police learned he messaged the teen who carried out a school shooting in Wisconsin about his own plans to target a government building with a gun or explosives.

Judge Laura Duffy issued a restraining order Wednesday under California's red flag gun law against the 20-year-old Carlsbad man effective until Dec. 23. A hearing was set for Jan. 3.

The order notes the man messaged Natalie Rupnow, 15, about attacking a government building.

Police tape is seen Tuesday outside the Abundant Life Christian School in Madison, Wis., after a shooting the prior day. Morry Gash, Associated Press

Police said Rupnow opened fire Monday at Abundant Life Christian School in Madison. She killed a student and a teacher and wounded six others before turning her gun on herself, according to police. Rupnow was a student at the school.

The California man was plotting a mass shooting with Rupnow, according to police notes in the restraining order. He told FBI agents that he told Rupnow that he planned to arm himself with explosives and target a government building, according to the notes. He did not specify which building or when he planned to launch his attack.

It was unclear if the man was in custody Wednesday evening.

The shooter had two handguns with her but used only one in the attack that killed a teacher and a student and wounded six others, the city's police chief said in an interview with The Associated Press on Wednesday.

Police were still investigating the motive, Madison Police Chief Shon Barnes said. "We may never know what she was thinking that day, but we'll do our best to try to add or give as much information to our public as possible," he said.

Supporters hold candles during a candlelight vigil Tuesday outside the Wisconsin Capitol in Madison, Wis., after a shooting the prior day at the Abundant Life Christian School. Morry Gash, Associated Press

Two other students who were shot remained in critical condition Wednesday.

The student who was killed was identified in an obituary released Wednesday as Rubi Patricia Vergara, 14, of Madison. She was a freshman at the school and "an avid reader, loved art, singing and playing keyboard in the family worship band," according to the obituary. The Associated Press' attempts to reach the girl's family by phone and email Wednesday evening were unsuccessful.

The Dane County medical examiner Wednesday evening identified the teacher who was killed as 42-year-old Erin Michelle West, after initially identifying her as Michelle E. West. A man who answered the phone at a number listed for West in public records hung up when reached by a reporter Wednesday evening.

Barnes released Rupnow's identity hours after the shooting Monday. Barnes said the medical examiner would release the names of those killed, but the state's crime victims privacy law bar releasing the names of those wounded.

Police, with the assistance of the FBI, were scouring online records and other resources and speaking with her parents and classmates in an attempt to determine a motive for the shooting, Barnes said.

Police don't know if anyone was targeted in the attack or if the attack was planned in advance, the chief said.

"I do not know if if she planned it that day or if she planned it a week prior," Barnes said. "To me, bringing a gun to school to hurt people is planning. And so we don't know what the premeditation is."

While Rupnow had two handguns, Barnes said he does not know how she obtained them and he declined to say who purchased them, citing the ongoing investigation.

No decisions had been made about whether Rupnow's parents might be charged in the shooting but they were cooperating, Barnes said.

Online court records show no criminal cases against her father, Jeffrey Rupnow, or her mother, Mellissa Rupnow. They are divorced and shared custody of their daughter, but she primarily lived with her father, according to court documents. Divorce records indicate that Natalie was in therapy in 2022, but don't say why.