A man who complained the world was treating Muslims "like dogs" plotted with an accomplice to kill Jews by bombing a synagogue, and possibly the Empire State building, and bought a grenade and guns for the attacks, authorities charged Thursday.

But there was no indication that what authorities called a homegrown plot, orchestrated as part of a sting operation, ever put New Yorkers in danger or that the men were affiliated with any terrorist organization.

The two suspects, 26-year-old Ahmed Ferhani, an Algerian, and 20-year-old Mohamed Mamdouh, a U.S. citizen of Moroccan descent accused of being his accomplice, were charged Thursday with conspiracy as a crime of terrorism under a rarely-used state law. Such cases are almost always handled by federal authorities.

Officials said the two men bought from an undercover officer an inert hand grenade and several weapons they intended to resell to help finance their plot to bomb a "major synagogue" in Manhattan.

Their attorneys said the two deny the charges.

"Mr. Ferhani tells me he hasn't committed any crime at all," lawyer Stephen Pokart said.

Mamdouh's attorney, Steven Fusfeld, said that even under the prosecutors' version of the events, Mamdouh's involvement would have been less than Ferhani's and it wasn't right to treat them equally.

"My client says he is not guilty of these crimes," Fusfeld said.

Officials said investigators had been using an undercover detective wearing a wire to track Ferhani for several months. Ferhani had been on their radar before but in October was arrested on a robbery charge in Manhattan. Officials said the detective heard Ferhani say he hated Jews and was fed up with the way Muslims — especially Palestinians — were treated around the world.

"They're treating us like dogs," Ferhani said once, according to police Commissioner Raymond Kelly.

According to a criminal complaint, Ferhani told the detective about "his intent to participate in jihad," meaning holy war, and that "he would become a martyr."

Eventually, authorities say, Ferhani brought Mamdouh in, but police did not say how the two knew each other. Officials also refused to give details on how the undercover officer met Ferhani.

But Ferhani started to show a pattern of growing anger over time, so much so that authorities decided to act, prosecutors said.

"His plans became bigger and more violent with every passing week," Manhattan District Attorney Cyrus R. Vance said.

The undercover detective and the men had several meetings during which Ferhani discussed the idea of attacking a synagogue, the complaint said. Mamdouh emphasized the need for proper training, the complaint said, so they would not get caught like "the one that put the car in Times Square" — an apparent reference to a failed car-bombing last year by Faisal Shahzad.

Ferhani was so aware of the possibility that he suggested renting a farmhouse upstate where they could shoot weapons to train and speak freely, police said.

Mamdouh is on tape saying he hated Jews, prosecutors said. Ferhani suggested disguising himself as a worshipping Jew so he could infiltrate a synagogue and leave a bomb inside, the complaint said. He also discussed using grenades "and described pulling the pins and throwing them into the synagogue," it added. They also talked about bombing a church, it said.

"It was clear that they intended to do that bombing on behalf of Islam and to send a message to the Jewish population," Assistant District Attorney Margaret Gandy told a judge during a brief arraignment at which the men, who each would face life in prison if convicted, were held without bail.

On May 5, the undercover detective introduced the men to another officer pretending to be an illegal gun dealer, and Ferhani stated he needed the weapons "for the cause," the complaint said.

"We gonna be victorious," it quoted Ferhani as saying.

At a roadside meeting Wednesday on Manhattan's West Side, one of the undercover officers handed Ferhani a bag holding three handguns, three boxes of ammo and the inert grenade.

As soon as Ferhani put the bag into the trunk of a car, he was arrested, the complaint said. Mamdouh, who had been dropped off nearby before the buy, was arrested soon afterward.

Police have been on high alert for potential threats to the city since the U.S. Navy SEAL raid that killed al-Qaida leader Osama bin Laden in Pakistan more than a week ago, though Kelly said the men had no apparent link to al-Qaida.

"We are concerned about lone wolves acting against New York City in the wake of the killing of bin Laden," Mayor Michael Bloomberg said. "Those perhaps are the toughest to stop."

New York passed its own anti-terrorism law within six days of the Sept. 11, 2001, attacks, but this was the first instance the law was used as it had been envisioned. The New York Police Department said the FBI was aware of the investigation and decided not to get involved.

"Any tip that comes in, the federal authorities have right of first refusal," Kelly said. "In this case, there was a strictly criminal aspect that started with the district attorney's office, and as a result it was logical to sort of keep it going when it morphed into a terrorism investigation."

The FBI on Thursday declined to comment.

The two suspects lived blocks from one another in Whitestone, a section of Queens. Residents said the middle-class neighborhood has a large Jewish and Italian population.

Jim Hartofilis, 57, said the arrest was a shock to the neighborhood. The area is ethnically diverse, he said, with nearby mosques, synagogues and churches. The neighborhood prides itself on its tolerance, he said.

"You wouldn't think something like this would come to our neighborhood," he said.

Ferhani's father told The New York Times the accusations were unbelievable.

"Bomb a synagogue? That's not my son," he said.

He said his son was friends with a diverse group of people and his girlfriend is Christian.

"All people are equal," he told the newspaper. "We don't make a distinction."

The family lived together after fleeing war-torn Algeria in 1995. The family claimed asylum, and Ferhani was granted permanent resident status but is now facing deportation.

Mamdouh, a tall lanky man who's a native of Casablanca, is a taxi service dispatcher. He came to the United States with his parents in August 1999, officials said. His attorney said he attended a local high school and lives in Queens with his brother and sister, and his parents are local business owners. He also is facing an unrelated burglary case in Queens.

Extra security had already been in place at local religious institutions since the death of bin Laden, and Jewish leaders said heightened awareness was a part of life.

"The fact that (there are) people who wish to injure and kill Jews is not news," said David Pollack, who helps advise synagogues on security.

The case recalled another NYPD investigation that resulted in the conviction of a Pakistani immigrant on charges he plotted to bomb the subway station in Herald Square to avenge the wartime abuses of Iraqis.

The suspect, Shahawar Matin Siraj, had caught the attention of a police informant and an undercover officer — both assigned to track Islamic extremists following the Sept. 11 attacks — with his anti-American rants.

After plotting with the informant, Siraj and another man who later became a cooperator against him were arrested on the eve of the 2004 Republican National Convention carrying crude diagrams of the subway station, situated below a dense shopping district that includes Macy's flagship department store.

Siraj, who said he never had a violent thought before he fell under the spell of the police informant, was sentenced in 2007 to 30 years in prison.


Associated Press writers Cristian Salazar, Jim Fitzgerald, Chris Hawley and Tom Hays contributed to this report.