When was the Trebuchet Invented?

The trebuchet was invented in the Middle Ages, most likely in the 12th century. There is some suggestion that primitive versions may go as far back as the 4th century BC.