An explosion followed by a massive fire wounded at least 21 people on a military ship stationed in San Diego, California, according to authorities and local media.

American television channels showed thick smoke billowing from the USS Bonhomme Richard assault warship that was undergoing maintenance at the naval base in San Diego, and firefighting boats were deployed around the ship to fight the fire with water cannons.

The explosion - whose causes are still unknown - was heard at a time when 160 sailors were on board, and according to the US Navy, 17 sailors and 4 civilians were lightly injured and taken to hospital, according to Agence France-Presse.

Media reports said many firefighters were also burned and inhaled smoke, and Colin Stewell, chief of fire in San Diego, told CNN that the fire could last for days.

Firefighters wrote on Twitter that many sailors received medical care for different wounds.

According to a number of testimonies reported by the media, an explosion was heard before the fire broke out on the ship.