OLYMPIA, Wash. -

Washington's Supreme Court says it's OK for police to briefly detain the companions of a suspect if they think it's necessary to ensure safety as they secure the scene of an arrest.

The 7-2 decision Thursday came in the case of Cody Flores, who was walking down a street in Moses Lake in 2013 with another man who was being sought by officers for pointing a gun at someone's head moments earlier.

As police arrested the other man, they ordered Flores to put his hands up, and Flores told them that he himself had a gun. An officer seized the weapon, and Flores was charged with illegal possession of a firearm.

At trial, Flores tried to suppress evidence of the gun, saying his brief detention by police was unconstitutional because the officers had no reason to suspect him of anything. The Supreme Court's opinion, by Justice Debra Stephens, overturned lower court rulings that sided with Flores.