(iStock)

A man who was shot by a D.C. police officer during a traffic stop Sunday refused to comply with commands to stay still after a high-capacity gun magazine was found on his lap, according to an arrest affidavit filed in court.

Police said that after the man was shot, they found a loaded 9mm semiautomatic handgun between the front passenger seat and center console of the Pontiac Grand Prix.

Donald Willis Jr., 48, of Southeast Washington was charged with possession of a firearm without a license and being a felon in possession of a handgun. Court documents say he has been previously convicted of a felony.

A D.C. Superior Court judge Tuesday ordered Willis detained until a preliminary hearing Friday. His attorney did not return a call seeking comment.

Police said two officers stopped the Grand Prix shortly before 4 a.m. in the 500 block of Alabama Avenue SE, in Congress Heights. The affidavit states police had received a complaint the occupants were involved in suspicious activity.

According to the arrest affidavit, an officer spotted the gun magazine and took it. The affidavit states Willis’s hands then “became very active and began making sudden movements.” According to the court documents, video from the officers’ body cameras shows Willis making a sudden movement toward his waistband as one officer shouts, “Don’t move.”

Police said in the affidavit that one of the officers fired five times, hitting the green Pontiac three times — twice in the driver’s side door and once in the left rear window. Willis drove away, and the Pontiac was later found abandoned in Southeast. Police said it was then they found the handgun.

The circumstances of the shooting remain under internal investigation.

Later that morning, police said, Willis walked into Washington Adventist Hospital in Takoma Park, Md., seeking treatment for a wound to the back of his right shoulder.

According to the affidavit, a detective who went to the hospital asked Willis who shot him. “Police shot me,” he answered. He told the detective he had abandoned the car in Southeast, the affidavit states.