A man was arrested in a Miami shooting on Sunday, telling officers that he “did it” but was defending himself, according to police.

Officers found a man shot in the leg shortly after 5 p.m. near Northwest 15th Avenue and 68th Street in Liberty City, Miami police said in an arrest affidavit.

Micah Lendale Tilley, 33, of Opa-locka, approached one of the officers and said, “I did it,” police said. “The shooting, I was defending myself.”

Surveillance footage from the area showed the victim, who was not identified by authorities, exiting a blue Ford Fiesta with a gun in his hand, police said. As the victim crossed the street, Tilley started firing a handgun at him.

Then Tilley retrieved a rifle from a Subaru during the gunfight and started firing it at the victim, police said. The victim ran, and Tilley followed while continuing to fire the rifle.

Tilley was arrested on charges including attempted second-degree murder and criminal solicitation, police said. He was being held without bond Monday at Turner Guilford Knight Correctional Center. His public defender didn’t respond to a request for comment.