SAN DIEGO — Immigration authorities caught barely half of the people who illegally entered the U.S. from Mexico last year, according to an internal Department of Homeland Security report that offers one of the most detailed assessments of border security ever compiled.

The report found that 54 percent of people who entered illegally between border crossings got caught in the 2015 fiscal year. That’s much lower than the 81 percent success rate that Homeland Security cited publicly using a different counting method.

The 98-page report was completed in May, and Homeland Security officials have declined to release it, despite urging from some members of Congress. The Associated Press obtained a copy from a government official involved in border issues.

The report offers the fullest measure yet how secure the border with Mexico really is – a major issue in a presidential campaign that features Republican nominee Donald Trump calling for a wall along the entire 1,954-mile border. The report includes enough material to argue that the government has made big strides or that it is falling woefully short.

In terms of people, 170,000 got away from the Border Patrol during the 2015 fiscal year, 210,000 the previous year and 1.7 million in 2005. The huge drop over the last decade is largely explained by the decline in job opportunities since the Great Recession, with more Mexicans now leaving the United States than arriving here.

During that time, there has also been a massive increase in border enforcement, including jail time and other serious consequences for those who get caught, and significant increases in the number of people getting deported. The government now spends $14 billion annually on border security.

The number of people who got away is larger when including those who escaped detection at border crossings or who entered by sea, which is the responsibility of Homeland Security agencies outside the Border Patrol. Adding those, 200,000 people got away last year, 260,000 in 2014 and 1.9 million in 2005.

The Border Patrol’s capture rate on the Mexican border was 55 percent in 2014 and 36 percent in 2005, according to the report prepared for Homeland Security by the Institute for Defense Analyses research organization. The Border Patrol achieved an 11-point improvement in 2014 after years of slow but steady gains.

The primary measure that Homeland Security has released for public consumption is the number of Border Patrol arrests, which tells how many people got caught but not how many got away.