When it comes to companies that are set to profit from President Donald Trump’s policies, here’s a clear winner: private prison operator CoreCivic (CXW).

The Nashville, Tennessee-based company has experienced almost a complete turnabout since Mr. Trump emerged victorious in the November election. Before voters cast their ballots, CoreCivic was having a rough year. Its stock had plunged by almost 50 percent from January 1, 2016 through Election Day. In August, the Justice Department said it would stop using private prisons, representing a hit to CoreCivic’s operations.

Yet just a few months later, CoreCivic’s fortunes have reversed, thanks largely to the election of President Trump and his directives to crack down on illegal immigrants. Since Mr. Trump’s victory, its shares have more than doubled, far outpacing the 9 percent gain in the S&P 500. Analysts now expect the company to have a strong 2017, with SunTrust Robinson Humphrey analyst Tobey Sommer describing it among one of his best investment picks for the year.

“It’s gone from a risk of seeing business go away to a chance for the company to grow,” Sommer said. “Because they have a lot of idle beds, they have an opportunity to sign new contracts and generate new profits.”

Get Breaking News Delivered to Your Inbox

CoreCivic may not be a familiar name, which in part may be due to its rebranding push in October. Previously known as Corrections Corporation of America, it changed its name to CoreCivic to reflect its shift from a corrections-focused company to providing a “wider range of government solutions,” CEO Damon Hininger said in a statement.

For instance, CoreCivic is investing in reentry programs, which help former inmates transition out of prisons and into the workforce, as well as in real estate.

CoreCivic declined an interview but in a statement said it offers services “to governments led by elected officials from across the political and ideological spectrum.”

Yet key to its near-term turnabout is President Trump’s crackdown on illegal immigrants. Mr. Trump has ordered the hiring of thousands of additional border patrol agents and U.S. Immigration and Customs Enforcement (ICE) workers as part of his vow to deport millions of unauthorized immigrants.

In a February 9 call with analysts to discuss CoreCivic’s latest earnings, Hininger credited the company’s fourth-quarter growth largely to what he called ICE’s “heightened utilization” of its services in Southwestern states. He also specifically cited Mr. Trump’s immigration policy, saying it will drive demand for the company’s detention facilities.

“When coupled with the above-average rate of crossings along the Southwest border, these executive orders appear likely to significantly increase the need for safe, humane and appropriate detention bed capacity that we have available in our existing real estate portfolio, as well as an increased demand for our detention facility design, development and facility maintenance expertise,” he said.

And indeed, authorities have been rounding up undocumented immigrants, although ICE said the raids were “routine” and similar to the efforts carried out under President Barack Obama.

Nevertheless, analysts expect CoreCivic and its main rival, the GEO Group (GEO), to profit from Mr. Trump’s directive. That’s partly due to the difference between how ICE’s detention centers operate compared with the prison system.

Private prisons hold about 8 percent of the country’s inmate population. On the other hand, private prisons and county jails hold 90 percent of immigration detainees, according to a Department of Homeland Security report in December. Even in facilities owned by ICE, many of the operations are carried out by personnel contracted from private companies, the report noted.

The bottom line? When ICE ramps up the number of immigration detainees, it will most likely turn to private companies such as CoreCivic to house them. In its fourth-quarter conference call, CoreCivic noted that it has 8,700 beds, or places for detainees or inmates, ready to be put to use, which Sommer said could add $125 million in profits before taxes and other costs.

While CoreCivic is set to profit from Mr. Trump’s directives, critics say the costs aren’t clearly known, ranging from the price tag to taxpayers as well as the ethical quandaries raised by profiting from incarceration.

Carl Takei, staff attorney for the American Civil Liberties Union’s National Prison Project, said while investors stand to profit, they shouldn’t lose sight of what he calls the moral issues wrapped up with the private prison industry.

“No matter what they say about being a government services company or providing valuable services to government agencies, this is a business model that doesn’t need to exist,” Takei said. “It represents the outsourcing of an essential government function to for-profit companies that have a fiduciary responsibility to shareholders, but not to the the public.”

A September ACLU report alleged that privately operated detention facilities “have a particularly grisly track record” because they have incentives to cut costs and boost shareholder return, such as by reducing medical staffing. The report cited alleged cases of violence, suicide and sexual assault.

While “a slice” of investors won’t put their money into private prison companies because of ethical issues, “It’s not widespread,” said Sommer. He added the corrections industry is “a very difficult, challenged industry with violence,” regardless of whether it’s private or government run.

“It doesn’t matter who is operating it from my perspective,” he said. “The notion that the quality of the services or facilities provided by the private companies is somehow subpar compared with government operated facilities doesn’t hold water with me.”

Some students at universities such as Princeton are pushing their colleges to divest from private prison companies, which could make the industry the latest to be targeted by the student divestment movement. In recent years, college students have pushed their campus administrators to rethink investments in stocks that they perceive as contributing to environmental or social harm, such as oil and tobacco companies.

“The contracts make it clear that this is about commodifying human beings,” the ACLU’s Takei said. “The government specifies they will deliver a certain number of units to the private prisons. The units in this context are human beings.”