Officers fatally shot a gunman who, while on a boat, fired at police and toward the shore of Bainbridge Island, about 10 miles west of Seattle across Elliott Bay in Washington state, authorities said.

The man’s death ended an hourslong standoff that temporarily forced the suspension of ferry services along the Washington coast.

Authorities said the man, who has not been identified, began firing shots about 8:30 p.m. Saturday. Assistant Fire Chief Luke Carpenter told the Seattle Times that the man “was just firing randomly” from the boat, docked near Eagle Harbor on the island’s southeast corner. He later began shooting at police officers after they arrived.

Authorities told residents just after 9 p.m. to avoid the shoreline near the harbor. A little more than an hour later, the city of Bainbridge Island warned residents who live near the shore to seek shelter and avoid windows.

The man stopped firing about 11 p.m., but the standoff continued, according to local media reports. Police used flash-bang grenades and smoking devices to get the man to surrender, KOMO News reported. About 12:30 a.m., he appeared on the boat’s deck, naked, according to a KOMO News photographer who was at the scene.

Later, he climbed back into the cabin and emerged with what appeared to be a rifle. A video taken by local media shows him aiming it, presumably at officers. That’s when police fired and struck him.

The man died about 1 a.m., authorities said. No one else was injured.

Kristen Drew, a KOMO News reporter who happened to be having dinner in the area when the shooting began, said she heard loud bangs that she thought were fireworks. Later, she saw officers with the Bainbridge Island Police Department on the dock with their guns drawn.

Authorities also have not said why the man began shooting. Kellie Stickney, a spokeswoman for the city, said officials can’t release further information because of a pending investigation.