Britain was at war with Spain, France and Holland in 1797. On the 11th of October a battle between the Dutch and British navy took place near to Bergen.
During the battle HMS Venerable's main mast was broken. Jack climbed the damaged mast and bravely managed to nail the Union Flag to it.
The British fleet had been split into two by Admiral Duncan to break through the Dutch vessels. This victory prevented the Dutch ships from joining the French to attack Ireland and then Britain. Jack was hailed as a hero and presented with a silver medal. He was presented to King George lll and granted a yearly pension of £30.
Prior to modern methods of communication, sailors used flags to communicate with other ships. The Union Flag was extremely symbolic, it showed the rest of the fleet that it was commanded by the Admiral of the fleet. The phrases 'show your true colors' and 'nail your colors to the mast' originated from these practices.