A man in New Jersey lured officers to him and then provoked the police to shoot him after ignoring their commands and acting in a threatening manner, prosecutors said Monday.

The ordeal started at 6:44 p.m. Sunday, when the Toms River police department received a 911 call reporting a man with a gun was seen in the area of Sand Creek Lane.

When officers arrived, they encountered the man, who they said had his right hand hidden behind hid back. He began walking toward the officers, who gave repeated, loud commands for the man to show his hands and put them in the air, the prosecutor said.

As the man continued toward the officers, the prosecutor said he quickly moved his right arm from behind his back and pointed a black object at the two officers who responded. The officers opened fire at the man, firing a total of nine shots and hitting the man twice.

The officers then moved in and provided first aid, the prosecutor said.

The man was taken to the hospital for treatment. There's no word on his condition.

The investigation later revealed that the man had made a 911 call to get police to respond, and the black object he was holding was a TV remote control he had taken from the hotel room where he had been staying nearby.

"Preliminary investigation revealed that the subject removed the black television remote from his room at the area motel and ultimately utilized the remote control to feign the presence of a deadly weapon, during his confrontation with the officers," Ocean County Prosecutor Joseph Coronato said in a news release.

Coronato said he isn't releasing any names at this point in the investigation, including the name of the man shot by police.

The investigation is being handled by the Ocean County Prosecutor's Office and the Ocean County Sheriff's Department CSI Unit.