PARIS -- An Islamic extremist with an arsenal of loaded guns was prevented from opening fire on churchgoers only because he accidentally shot himself in the leg, French officials said Wednesday.

The 24-year-old computer science student, who was also suspected in the death of a young woman whose body was found on Sunday shortly before his arrest, had been flagged as a risk for intent to travel to Syria but there had been no specific reason to open a judicial investigation, Interior Minister Bernard Cazeneuve said Wednesday.

Paris Prosecutor Francois Molins said the suspect -- an Algerian who had lived in France for several years -- was arrested in Paris Sunday after he apparently shot himself by accident and called for an ambulance.

He was waiting outside his apartment building for first aid when police arrived. They followed a trail of blood to his car, which contained loaded guns, and notes about potential targets.

A search of his apartment in southeastern Paris turned up more weapons including three Kalashnikov assault rifles along with phones and computers that police used to establish that he'd been in communication with someone "who could have been in Syria," Molins said at a news conference.

This person "explicitly asked him to target a church," Molins said, declining to answer questions about the investigation into what he termed "an imminent attack."

Police also found Arabic-language material that mentioned al-Qaida and the Islamic State group in the man's apartment, Molins said. There was no immediate evidence that the suspect had direct ties to any organized groups, said a French security official who was not authorized to publicly release details.

Police arrested one person believed to be acquainted with the suspect Wednesday evening in the town of Saint-Dizier, Molins said, but gave no further details.

Aurelie Chatelain, a 32-year-old Frenchwoman visiting in Paris, was found shot to death in her car on Sunday morning. The security official said Chatelain appeared to have been killed at random and ballistics evidence linked her death to the suspect.

The suspect was treated for a leg wound and remained hospitalized on Wednesday.

An attack on a church would be a new target in France, where Jewish sites have been under increased protection since the 2012 attack on a Jewish school and the killings at a kosher supermarket this year.

Extremists have targeted Christians in the Middle East. A video released on Sunday showed Islamic State militants in Libya killing captive Ethiopian Christians.

"The terrorists target France to divide us," Prime Minister Manuel Valls said Wednesday.

France has been on edge since the Jan. 7-9 attacks on the satirical newspaper Charlie Hebdo and a kosher supermarket left 20 people dead, including the three gunmen. In that case, at least two of the gunmen had been flagged to French intelligence -- and the third had been recently released from prison after serving a sentence involving his ties to Islamic extremists -- but surveillance was called off months before the attack.

The thwarted attack was announced hours before Cazeneuve met with executives from top Internet companies, including Google and Twitter, to talk about the government's plan to increase online surveillance and block jihadi propaganda.