Private prison stocks soared in morning trading Wednesday, fueled by Donald Trump's surprise presidential victory.

Stocks made a modest climb in volatile trading at market open, calming the nerves of investors who saw futures markets crater overnight. Private prison companies, however, soared. Corrections Corp. of America (CXW) - Get Report , which recently rebranded as CoreCivic, surged 36.22% to $19.33 in late-morning trading, and The Geo Group (GEO) - Get Report climbed 17.25% to $28.00. Both stocks took major hits over the summer when the U.S. government signaled it would phase out its use of private prisons.

The Department of Justice in mid-August announced plans to end its use of private prisons after concluding such facilities do not provide the same level of services in terms of safety or cost as those run by the government. The announcement sent both Geo and CCA tumbling. The companies were dealt another blow days later when Department of Homeland Security Secretary Jeh Johnson said the Homeland Security Advisory Council would create a committee to review its policy and practices concerning private prisons.

In 2015, the U.S. federal government accounted for 45% of Geo's revenues. For CCA, it accounted for 51% of total revenues that year. Last year, the companies reported $1.84 billion and $1.79 billion in revenue, respectively.

Any concerns over lost federal business appear to have been washed away by Trump's win. In fact, both companies stand to benefit from his campaign trail policies, should they be enacted.

As The Daily Beast's Betsy Woodruff pointed out in September, Trump sang praises for private prisons in a June interview with MSNBC's Chris Matthews.

"I do think we can do a lot of privatizations and private prisons," he said. "It seems to work a lot better."

Trump's law-and-order campaign mantra and hard-line view on criminal justice bodes well for private prisons. So do his immigration policies.

The president-elect has proposed deporting up to 11 million immigrants in the country illegally (later in his campaign he began to say he would first deal only with criminals). Regardless of the amount, individuals set to be deported would need to go through a judicial process that entails some time in a detention center.

Both Geo and CCA have contracts with U.S. Immigration and Customs Enforcement (ICE). In 2013, the Department of Homeland Security reported that undocumented immigrants were detained by ICE for an average of 33.5 days at a cost of $118.88 per day per bed. ICE accounted for 24% of CCA's total revenues in 2014.

The Geo Group, at least, appears to have been well aware that a Trump presidency would be good for it: the Florida-based company donated $150,000 to a pro-Trump super PAC.

"We have worked for 30 years with Democratic and Republican administrations to help meet the correctional and rehabilitation needs at the federal level. We look forward to working with both the new Administration and the new Congress in continuing our longstanding partnership with the federal government providing high quality and cost effective rehabilitation programs and post-release services, with the continued belief that we are at our best as a company when those we care for re-enter society as productive and employable citizens," said a Geo Group spokesman in a statement.

"Elected leaders at all levels of government are facing the realities of an increasingly complex and budget-constrained world, and we believe the company we've evolved into today provides us with a platform to grow where our partners want and need solutions. The American people have incredibly high expectations for solving the very real and serious problems facing our country, and CoreCivic is well-positioned to provide innovative, dependable solutions to help tackle some of those big challenges, as we have for more than 30 years," said CCA spokesman Steven Owen.