A man opened fire on passersby in the central Italian city of Macerata on Saturday, injuring six African migrants in an attack that officials say appear to be racially motivated.

The shootings happened just days after the dismembered body of Pamela Mastropietro, 18, was discovered hidden in two suitcases near Macerata. Nigerian migrant Innocent Oseghale, 29, has been arrested in connection with her death.

The six migrants were shot by a man firing from his car window beginning shortly after 11 a.m. local time Saturday as he drove around the city, located about 200 kilometres east of Rome.

"Shots fired in Macerata. People injured. Police operation under way. Stay out of the way and avoid open places," the police said on Twitter. Shortly afterwards, police said one man had been arrested.

Italy's interior minister says the suspected gunman was immersed in "racial hatred" and had an extreme-right background with both neo-Nazi and neo-fascist ties. Marco Minniti told reporters in Macerata that the suspect had acted alone Saturday but planned the attack in advance.

Premier Paolo Gentiloni condemned the drive-by shooting spree, saying "hatred and violence will not succeed in dividing us." 

Gentiloni said that "one thing is certain, that horrendous crimes and criminal behaviour will be prosecuted and punished. This is the law."

ITALY CRIME MACERATA SHOOTING

Italian nationalist Luca Traini was arrested by police in connection with the shooting. (EPA-EFE)

Mayor Romano Carancini told Sky TG24 that the victims were five men and one woman. He confirmed all were foreigners and black.

"They were all of colour. This is obviously a grave fact. As was grave what happened to Pamela. The closeness of the two events makes you imagine there could be a connection," Carancini said.

He said one of the wounded suffered life-threatening injuries. 

Hospital officials say one person was treated and released. Of the other five victims, authorities said late Saturday that one was in intensive care, while the others had either undergone surgery or were scheduled to have surgery.

Italian suspect apprehended

Italian authorities have identified the suspected gunman apprehended by police as Luca Traini, a 28-year-old Italian with no previous record. Traini had run unsuccessfully as a candidate for the anti-migrant Northern League in a local election last year in the city of Corridonia.

A video posted by the newspaper il Resto di Carlino showed a man with an Italian flag draped over his shoulders being arrested by armed Carabinieri officers a short distance from where he apparently fled his car on foot.

Italian news reports said the man did a fascist salute as he was arrested, but no salute was visible in the video.

Right-wing politicians campaigning ahead of national elections on March 4 leaped on the gruesome death of Mastropietro to promote their anti-migrant message.

Macerata Italy

The mayor of Macerata urged people to remain indoors after reports of drive-by shootings in the city of about 43,000, about 200 kilometres east of Rome. (Google Streetview)

A preliminary postmortem on the teenager could not immediately identify her cause of death. The Nigerian suspect, who was denied asylum last year but has remained in Italy, has refused to talk to police.

"What was this worm still doing in Italy?" Matteo Salvini, head of the far-right League, wrote on Facebook, accusing the centre-left government of responsibility for Mastropietro's death for allowing migrants to stay in the country.

"The left has blood on its hands," he wrote.

He is pledging to deport 150,000 migrants in his first year in office if his party wins control of parliament and he is named premier.

That has drawn sharp rebukes that Salvini is using the migrant crisis to foment xenophobia for political gain.

Senate president Pietro Grasso, who is fielding a small liberal party called Free and Equal, chastised Salvini for using a tragedy for electoral gain.

 "Whoever, like Salvini, exploits news events and tragedies for electoral purposes is among those responsible for the spiral of hatred and violence that we must stop as soon as possible," Grasso said.

Magistrates say witnesses saw the Nigerian suspect carrying the suitcases that were later found to contain the teenager's body. They also found blood-stained clothes and knives in his possession. 

With files from The Associated Press