Police in Illinois say they have captured a person of interest associated with a shooting that killed six people and wounded more than 36 others.

A man with a high-powered rifle opened fire from a rooftop at a Fourth of July parade in the Chicago suburb of Highland Park.

Police had previously identified a person of interest in the shooting, 22-year-old Robert E Crimo III, who was from the area. They said he was driving a silver 2010 Honda Fit automobile.

"He is considered armed and dangerous," a sheriff's department spokesperson said, adding that people should not approach him if they see him.

Officials said a rifle was recovered from the scene.

More than 36 people were injured, mostly with gunshot wounds, said a spokesman for the NorthShore University Health System.

The 26 victims taken to the Highland Park hospital ranged in age from eight to 85, said Brigham Temple, an emergency room doctor.

At least one of those killed was a Mexican national, a senior Mexican Foreign Ministry official said on Twitter.

The shooting comes with gun violence fresh on the minds of many Americans after a massacre on 24 May killed 19 schoolchildren and two teachers at an elementary school in Uvalde, Texas, which followed an attack on 14 May that killed 10 people at a supermarket in Buffalo, New York.

Children waving American flags, riding tricycles or enjoying a ride in a wagon pulled by adults froze as people in the crowd screamed while gunshots rang out, video on social media showed.

One mobile phone video appeared to record what sounded to be about 30 rapid shots, a pause, and then another roughly 30 shots.

Between the two bursts, a woman can be heard saying from the side of the parade route: "My God, what happened?"

Police said the shooting took place from the rooftop of a business that the gunman reached via an alley ladder attached to the building that was not secure. They did not have a motive for the shooting.

President Joe Biden said he and his wife Jill were "shocked by the senseless gun violence that has yet again brought grief to an American community on this Independence Day."

Mr Biden said he had "urged federal law enforcement to assist in the urgent search for the shooter."

In his statement, Mr Biden referred to bipartisan gun-reform legislation he signed recently but said much more needed to be done and added: "I'm not going to give up fighting the epidemic of gun violence."

Amarani Garcia, who was at the parade with her young daughter, said she heard gunfire, then a pause for what she suspected was reloading, and then more shots.

There were "people screaming and running. It was just really traumatising," Ms Garcia said.

"I was very terrified. I hid with my daughter actually in a little store. It just makes me feel like we're not safe anymore."

A 36-year-old native of Highland Park who wanted to be identified only as Sara, said she had attended the annual parade most years since her childhood.

"Not even five minutes after, very shortly after, the police and firetrucks part of the parade had gone by I heard 'pop, pop, pop, pop, pop,'" she said, adding that she first thought they were muskets some times used in parades.

"I looked and there were no muskets. The popping didn't stop... again it went 'pop, pop, pop, pop, pop' and I turned and I said 'those are gunshots, run!'"

Highland Park's population is 30,000 and nearly 90% white, according to the US Census Bureau. About a third of the population is Jewish, according to the Jewish Telegraphic Agency.

US Representative Brad Schneider, who was at the event, said on Twitter that "a shooter struck in Highland Park during the Independence Day parade".

"Hearing of loss of life and others injured. My condolences to the family and loved ones; my prayers for the injured and for my community," he wrote, adding: "Enough is enough!"

Firearms cause approximately 40,000 deaths a year in the United States, including suicides, according to the Gun Violence Archive website.

The debate over gun control - a deeply divisive issue in the country - was reignited by two massacres in May that saw 10 black supermarket shoppers shot dead in upstate New York and 21 people, mostly young children, killed at a primary school in Texas.

Congress passed the first significant bill on gun safety in decades in the wake of those killings. President Joe Biden signed it into law in late June, saying that while it falls short of what is really needed, it will still save lives.