(CNN) -- A Philadelphia, Pennsylvania, police officer who told authorities he was shot while on patrol last month has admitted he shot himself intentionally, the city's police commissioner said Tuesday.

Sgt. Robert Ralston, 46, confessed to police early Tuesday morning that he made up the story, possibly to a get attention or a transfer, Philadelphia Police Commissioner Charles Ramsey said in a news conference.

Ralston reported that on April 5 he saw two African-American males arguing on a train track in West Philadelphia. He told investigators that when he stopped the two men for questioning one of them pulled out a gun and shot him in the left shoulder.

His claim sparked a search for a phantom suspect.

Ramsey noted that there were many inconsistencies throughout the month-long investigation.

"The evidence never did match up. We have forensic evidence at the scene that did not match with the story," he said.

One example of inconsistent evidence was that the gunpowder residue found on Ralston's shirt matched the ammunition used by the police department, he said.

The commissioner said that Ralston, who is white, told police his attackers were black because the district where the shooting took place is predominately black.

"It's troubling in a lot of ways," Ramsey said. "It inflames racial tensions in our community, and that's certainly something we don't need."

Ralston, a 21-year veteran of the police force, will be made to pay the cost of the investigation that followed his report, and has been suspended with the intent to dismiss, Ramsey said.

He will not, however, face criminal charges because police granted him immunity to obtain his confession.