The 22-year-old suspect of a mass shooting during a Fourth of July parade in the Chicago suburb of Highland Park has been "taken into custody without incident", police said.
The police identified the suspect as Robert "Bobby" Crimo III, but gave no indication of the motive for the shooting that killed six and injured 24 others, reports Xinhua news agency.
Highland Park is an affluent neighbourhood 43 km north of Chicago.
The gunman, who was detained after a massive manhunt, used "a high-powered rifle", and shot from a rooftop, Sergeant Christopher Covelli from the Lake County Major Crime Task Force said at the news briefing late Monday night.
The rifle has been recovered at the scene, he added.
Covelli called the crime "very random, very intentional".
The gunman opened fire at the parade at around 10.15 a.m. on Monday, just a few minutes after it began, the BBC reported.
The event was scheduled to include floats, marching bands, and community entertainment as part of the city's Independence Day celebrations.
Following the mass shooting, all events in Highland Park and the surrounding communities were cancelled.
Illinois Governor Jay Robert Pritzker warned that mass shootings were becoming an "American tradition".
"There are going to be people who are going to say that today is not the day, that now is not the time to talk about guns. I'm telling you there is no better day and no better time then right here and right now," the BBC quoted the Democratic Governor as saying.
Shocked at the violence, President Joe Biden vowed to keep fighting "the epidemic of gun violence" in the country.
"I'm not going to give up," he said, speaking outside the White House.
Monday's mass shooting came a week after Biden signed the first significant federal bill on gun safety in nearly 30 years.
The legislation seeks to expand background check for prospective gun buyers, prevents abusive boyfriends and partners from buying guns and seeks to encourage states to pass laws to allow authorities and relatives to deny gun possession to people who are a danger to themselves and others.
There have been more than 21,800 deaths from gun violence and 296 mass shootings across the country since the beginning of this year, according to the latest data from the Gun Violence Archive.