Around 4:30 a.m. on Saturday, the uniformed 77th Precinct officer was safeguarding a gun inside a Ford van at 790 Bergen St. in the Crown Heights section of Brooklyn as officers awaited a search warrant, police said.

The gun was believed to have been used in a shooting incident earlier in the night in which a man suffered a graze wound to the head.

The officer guarding the van saw three males going in through the driver’s side door. He got out of his squad car, identified himself and ordered the men to stop, police said.

When the suspects did not stop, the officer fired and struck one of them in the left buttock, police said.

One of the suspects was hospitalized under police guard Saturday evening after being shot by a police officer.

Police have identified the suspects as Geremy Botor and Kevin Johnson, both 17.

Both men have been charged with criminal possession of a weapon, assault, grand larceny and obstructing governmental administration. Johnson was also charged with prohibited use of a weapon for the earlier shooting, police said.

A third suspect fled the scene, police said.

The injured teen was taken to Kings County Medical Center, where his condition was reported as stable, police said.

It was unclear which suspect was wounded by the officer.

The officer was not injured, but was taken to New York Methodist Hospital for evaluation, police said.