A ferry experienced a mechanical problem and crashed into a pier in a busy tourist area, injuring nine people, authorities said.

The U.S. Coast Guard was investigating the exact cause of the accident, which occurred Saturday afternoon. Moments earlier, the captain yelled out a warning over the ferry's public address system.

"He screamed three times, 'Hang on! Hang on! Hang on!"' said passenger Bahman Azari, of Vallejo. "It was pretty dramatic."

The Baylink ferry, carrying 138 people, plowed into Pier 43 in the city's Fisherman's Wharf district. It had just left Pier 41 and was heading to Vallejo when it apparently lost control of its steering and veered into the wood pilings of the other pier, fire officials said.

"There was a mechanical problem when they were backing out," Assistant Fire Chief Jim Barden said.

Nine people were taken to local hospitals with minor injuries. The crash drew a large number of onlookers from the crowds who came to the wharf to eat, shop and watch street performers.

Paul Cunningham, 41, of Vallejo, was on the ferry with five family members after a day trip to San Francisco.

"It pretty much threw everybody around that wasn't sitting down," he said. "It was a good jolt."

Fire officials used a tugboat to tow the ferry back to Pier 41, where passengers disembarked, authorities said. No major damage to the boat was visible and the Coast Guard said no fuel was leaked in the San Francisco Bay.