President Trump said Wednesday that the U.S. will focus on combating the Islamic State's online recruiting efforts following recent military gains in Iraq.

The terrorist organization was pushed out of Mosul this summer and continues to lose ground in the three-year-old war with the U.S.-led coalition in Iraq, but it has also proved adept at using the Internet to attract followers, distribute propaganda, and orchestrate foreign attacks.

"I will tell you, we are going to start working very hard on the Internet because they are using the Internet at a level that they should not be allowed to use the Internet," Trump said during a bill-signing event with the American Legion in Reno, Nev. "They're recruiting from the Internet and we are going to work under my administration very hard so that doesn't happen."

The group most recently claimed responsibility for a terror attack in Spain last week that killed 14 and involved a dozen suspects who may have been partly radicalized online. The attack, which involved a vehicle running down pedestrians on a busy plaza, was the latest in a string of terror attacks in England, France and elsewhere in Europe.

Trump said the U.S. has meanwhile made "tremendous" military progress against ISIS, which seized large portions of Iraq in 2014 after sweeping across the Syrian border.

"We are stripping terrorists of their territory at a record clip — their funding, their networks and the false allure of their ideology," he said.

Defense Secretary Jim Mattis warned Tuesday that the fight was still not over and there would be "hard fighting ahead."