It began before Jefferson was president. He was then the American ambassador to France, and he was disturbed by what was happening in the Mediterranean. For centuries, the "Barbary Coast Pirates" had been raiding ships passing through the Mediterranean. These were not "pirates" in the sense that we usually think of them. They weren't rogue agents acting independently. They worked for the governments of the North African countries. They would steal the ship and return to their countries, confiscating the booty aboard the ship, most of which added to the wealth of the Islamic state. They also took the ship's crew members captive and ransomed the ones they could. Most of that money also went to the Islamic government. The crew who could not be ransomed were sold into slavery.
In addition, these "pirates" randomly raided towns on the coasts of Europe and captured people, bringing them back to North Africa to ransom or sell into slavery. They even came so far as the shores of America to capture settlers, to bring them back to Africa to ransom or sell. They especially prized young women and children who could be used as concubines or made into eunuchs. Over a million Europeans and Americans were sold into slavery during the 200-year reign of the Muslim "Barbary Coast" rulers.
Many European countries wanted this to stop, of course, to which the leaders of the North African countries replied, "All you have to do is pay us a certain amount of money annually, and we will not attack ships from your country." Many European countries paid the tribute. It was cheaper than going to war. Of course, that was a short-term, self-defeating solution, since paying the tribute made the North African Muslim countries more powerful and more capable of terror, plunder, and mayhem.
The United States was paying this tribute also. This bothered Jefferson. It just so happened that while he was an ambassador in France, Jefferson met with John Adams (then the American ambassador to Britain) and together the two men met with the ambassador from Tripoli (one of the North African Muslim pirate countries). Jefferson and Adams sat down to talk with this man. They asked him why Tripoli attacked ships. Why attack the United States? They had no previous interactions. Why the hostility? Why did they choose America as an enemy?
The Tripoli Muslim ambassador was very straightforward. He said, basically, "That's what we do. We are commanded to do so by Allah." Jefferson later wrote that the Tripoli ambassador told him, "It was written in their Koran that all nations which had not acknowledged the Prophet were sinners, whom it was the right and duty of the faithful to plunder and enslave; and that every mussulman (Muslim) who was slain in this warfare was sure to go to Paradise."
Completely taken aback by this revelation, Jefferson decided to look into the matter further, and did the one thing everyone should do: He read the Koran. He learned what Islam was about.
And when he became president, he expanded and then mobilized the United States Navy to protect American ships from Muslim piracy and then sent Marines to the shores of Tripoli, who soundly defeated the Muslim warriors. This brought an end to the "Barbary Coast Pirates." This was the first foreign war fought by the U.S. and military aggressiveness of Islamic countries remained contained and weakened for over a century.
It's amazing what a little accurate information can do.
Read more: Thomas Jefferson's Koran.
And for goodness sake, Take the Pledge to read the Koran yourself and convince everyone you know to do the same.