A man accused of opening fire on a Fourth of July parade near Chicago contemplated a second attack after the deadly shooting, authorities say.
According to police, the 21-year-old suspect drove for more than two hours to Wisconsin after the shooting, which left seven dead and dozens wounded.
He saw another Independence Day celebration there and allegedly considered attacking it, police said.
During a court hearing, prosecutors also said he confessed to the shooting.
At Wednesday's court appearance, a judge ruled that the suspect, Robert Crimo, would be held without bail and assigned a public lawyer.
At a news conference following the hearing, police said investigators had determined that Mr Crimo attempted to dump his phone in Madison, Wisconsin after the Monday morning attack in the Chicago suburb of Highland Park.
Police said the gunman told them he had disguised himself as a woman so he could escape Highland Park alongside fleeing residents.
In the brief hearing, Assistant State Attorney Ben Dillon said surveillance video showed the suspect leaving the area and dumping a rifle. He then took his mother's car and drove about 150 miles (240 km) north-west to Madison.
Madison's police chief said in a news conference that the FBI called around 17:00 local time (22:00 GMT) on Monday to request that the force mobilise its SWAT team due to the suspect being in their area.
But before the tactical team was ready, the police learned that the suspect had been caught.
According to Mr Dillon, the gunman then confessed after being caught, telling police he "looked down his sights, aimed, then opened fire at people across the street".
If convicted, the seven murder counts the suspected gunman currently faces would carry a mandatory sentence of life in prison without parole. Dozens more charges are expected before the investigation ends.
Prosecutors said on Wednesday that 83 spent shell casings, as well as rifle magazines, were recovered from the scene of the shooting.
The new information comes as questions are being raised over how the suspect was able to buy guns.
He passed background checks meant to prevent potentially dangerous individuals from buying weapons, even though he had previously made threats that were reported to authorities.
Three other firearms were also found at his home. Police said the suspect had two prior contacts with law enforcement but was still able to purchase five guns in the past year.
In April 2019, police were called to the suspect's home one week after he reportedly attempted to take his own life. And in September 2019, police were called by a family member who said he had made violent threats to "kill everyone".
Police responded and seized 16 knives, a dagger and a sword from his home. He was not arrested and no further action was taken.
In a separate and more recent incident, Mr Crimo reportedly behaved suspiciously during an April visit to a local synagogue during Passover. A volunteer security co-ordinator told The Forward, a Jewish news organisation, that he believed the suspect was "sizing up" the facility, although he left without incident.
Illinois state police said that the suspect's father sponsored his application for a firearms licence in December 2019 when he was just 19. His uncle denied this in a statement to the Chicago Sun.
Illinois is one of 19 US states with so-called red flag laws, designed to keep guns out of the hands of people who may pose a danger to themselves or others. Some commentators have pointed to the Highland Park shooting as evidence that similar regulations are ineffective.
Allison Anderman, an attorney at the Giffords Law Center to Prevent Gun Violence, said that "implementation seems to have been an issue" in his case.
The Illinois law came into effect in January 2019, just months before police first encountered the gunman.
Ms Anderman added that red flag laws do not require individuals to be taken into custody. Instead, they simply prevent them from having guns until they "get their crisis under control".
"It's very possible that law enforcement officers did not know about it or did not know how to properly use it," she said. "A single instance where a law was not properly implemented does not call into question the effectiveness of these laws".
Experts believe that data suggests that red flag laws are at least somewhat effective. In Florida, for example, data shows that judges have acted more than 8,000 times under that state's version of the law to restrict gun access.
"These are people who were either troubled or emotionally dysregulated. or expressing homicidal threats, that had guns taken away," said Dexter Voisin, a social sciences professor and gun violence expert at Case Western Reserve University in Ohio.
"It's not that the laws don't work. It's that folks actually have to work with the system".