The pirate who wanted to sell gold

I´ll tell you a story that I have recently found in an abridged and simplified book with French legends. I got the book at a fair in France. It is aimed at people who study French. I have been learning this language for less than a year so I guess I might have misinterpreted the story a bit. But I will summarise it to you anyway. The book is about a pirate who lives in the 17th century. He and his crew attack a ship of passengers going from Spain to England. The pirate steals a chest full of gold bullion from the ship. He decides to travel back to Spain and sell gold to a famous investor. On his way home, a violent storm starts all of a sudden. A flash of lighting strikes the ship and kills most of the crew members. The ship gets destroyed and nearly sinks. The captain loses some of his gold, but he manages to preserve a couple of bars. After the storm, the ship is attacked by a group of pirates from Portugal. They kill some other crew members and attack the captain himself. He offers the rest of his gold to them. They save his life in exchange. The captain returns home, unable to sell gold, wounded, sick and poor. He decides to stay in his hometown and forget about his past. However, the pirates who had attacked his ship at sea seem to have a reason to look for him.