BEIRUT — The Islamic State may still have in excess of 30,000 fighters in Syria and Iraq and appears to have rebounded from some of its worst setbacks, according to two new reports that call into question whether the militants are as close to defeat as the U.S. military has suggested.

The figures, contained in reports by the U.S. government and the United Nations, are far higher than previous estimates of Islamic State strength following its major defeats last year, when militants were driven out of their territory in Iraq and most of their key strongholds in Syria. The U.S. military has not released any figures since last year, but comments by military officials had indicated there were not many more than 10,000 fighters left.

U.S. military officials disputed the new assessments but declined to give alternative numbers, saying it is against military policy. The figures “seemed high,” said Col. Sean Ryan, the U.S. military spokesman in Baghdad, but he added that “with all the variables, there is really no way to know.”

“As far as we are concerned, ISIS remains a threat as long as they have the capability to launch terror attacks anywhere, and we will pursue them until they are completely defeated,” he said.

The U.S. government report attributed its numbers to the Defense Department but acknowledged that such estimates “have varied sharply among sources and over time.” The report was delivered to Congress by the Lead Inspector General. Quoting Defense Department officials, the report put the number of fighters in Iraq at between 15,500 and 17,100 and in Syria at 14,000.

The second report was written by the U.N. Analytical Support and Sanctions Monitoring Team and offered a similar figure. Quoting unnamed member states, it said there are believed to be between 20,000 and 30,000 Islamic State fighters across Iraq and Syria, divided roughly equally between the two countries. Some of them are active on the battlefield, while others are hiding out in communities or remote areas, it said.

At its peak, the Islamic State is thought to have mustered an army of about 100,000 men, spread across the vast area spanning Syria and Iraq that once composed its self-proclaimed caliphate. They included as many as 30,000 foreign fighters from all over the world.

Both new reports note, however, that although the Islamic State is close to total territorial defeat, it remains a potent threat to the stability of Iraq and Syria. Taken together, the reports suggest that the military campaign still has a long way to go before the Islamic State can be said to have been vanquished, despite President Trump’s assertion last month that the battle against the group was “98 percent” finished.