What happens to convicts in prison/jail when territory is ceded from one country to another?

Years ago, I watched a Japanese anime which depicted an interstellar war type scenario. At one point, one side captured a planet, but it happened to be that the planet was a prison planet and good percentage of the population was incarcerated there for crimes against the former rulers of that part of space. There was some discussion over whether the planet’s new overlords should release the prisoners, but iirc a decision was made that even though none of the prisoners are guilty of any offense against the laws of the country now ruling the planet, they nonetheless represent a generalized danger to society and cannot be released immediately.

What happens in real life when territory becomes part of another country (whether ceded peacefully through diplomatic channels or conquered in war) and there are people incarcerated in that territory for crimes against the former sovereign? One obvious thought that comes to mind would be that the prisoners would continue to serve whatever sentence they had under the old government, but the prison would now be run by the new government. This doesn’t seem right, though. Substantive and procedural criminal law varies from country to country and I can’t see the US being terribly happy with inheriting non-trivial numbers of former Mexicans incarcerated in California prisons for the crimes of practicing an unauthorized religion and possessing anti-government protest pamphlets interspersed among the allegedly violent desperados and banditos and none of them got a fair and speedy public jury trial anyway and several have sentences that would be considered cruel and unusual if imposed by a US judge. One or two might have even been in there for treason against Mexico for attempting to aid the US - certainly not something that most Americans would approve is deserving of continued imprisonment in the US.

When the US has taken over territory, has there been a program where current prisoners in the territory can have their convictions and sentences reviewed for conformance with the US Constitution or applicable standards of acceptable community behavior in the US, with truly and provably dangerous violent felons kept in with perhaps a minor reduction in sentence to make their sentence not cruel or unusual, while the downtrodden who were imprisoned under oppressive freedom-sapping laws are released to enjoy their new status as free Americans?

Were prisoners who were convicted of things like burglary or rape that are generally illegal in the US too but who didn’t get a jury trial, were forced to testify against themself, were denied the right to confront their accusers, or had been convicted based on evidence obtained in an unreasonable search and seizure entitled to be retried in a US court?

What about other countries? For example, when Western Papua became part of Indonesia in 1969, were the crimes of Papuan prisoners re-evaluated under Indonesian law or standards of behavior and their trials re-evaluated for conformance with Indonesian criminal procedure with appropriate adjustments of sentences, releases, and orders for retrials?

This states that the number of prisoners in the former East Germany fell significantly from 1990 to 1995 because many political offenses that were prosecutable under East German law were abolished with reunification with West Germany, but it doesn’t indicate whether this was because East German political prisoners had mostly wrapped up their sentences by 1995 or whether there was a program where Federal Republic of Germany officials entered now-former East German prisons and identified specific convicts imprisoned by East Germany as political prisoners and worthy of immediate release and others as street thugs, mobsters, drug dealers, and child molesters as worthy of punishment under unified Germany as they were under East Germany and marked for continued imprisonment.

Newly independent countries could also be in scope. For example, when the US became independent, were people imprisoned in New York under British laws related to restrictions on freedom of speech released while people imprisoned in New York under British laws against rape and murder were transferred to the New York State Department of Corrections to complete their original British sentences?

When the United States took the Philippines from Spain, there was a long-lasting controversy over precisely this issue. The case that went to the Supreme Court concerned a man sentenced to 12 years hard labor with his wrists chained to his ankles for forgery, and whether this should be commuted because it was “Cruel and Unusual Punishment”. The issue was characterized in the popular press as “Does the constitution follow the flag?” (that is, now that the US owned it, does the US constitution apply?) A cartoonist jibed, “I don’t know if the constitution follows the flag, but I know the Supreme Court follows the election returns.”

There was a programme by which convictions and sentences were reviewed, and people were selectively released. It wasn’t straightforward, since people targetted by the authorities for political reasons might be charged with non-political offences, and people actually guilty of non-political offences might have received excessive sentences for political reasons. I don’t know the details of the programme but - forseeably - there was some public disquiet that some of the people released ought not to have been.

New York as a colony had its own legal system and its own legal authorities which would have continued in force on independence, except to the extent changed by the legislature or, in time, overridden by the adoption of the US constitution.

So, nobody was imprisoned under “British” laws about, e.g., rape. They were imprisoned under New York laws about rape (which no doubt were based on, and similar or identical to, English laws).

Even in “free countries” there are sometimes rumors or allegations that such and such person was treated unfairly by the police or in criminal court due to political reasons. If a corrupt mayor and district attorney can railroad someone to state prison in the US in the 21st century and stand a good chance of getting away with it for a few years until the case becomes notorious and the press buzzes around it and the Supreme Court agrees to take it, it’s scary to think about what the Socialist Unity Party of Germany could have done to you if you pissed it off.

If North Korea falls and South Korea or the US takes over and the stories of entire cities of political prisoners are actually true, I would imagine there would be a huge huge issue with going file by file and freeing thousands and thousands of prisoners with an occasional prisoner or two not freed because review indicated that the North Korean conviction was fair even under the standards of a free country.

Okay, but the standard for New York laws prior to New York joining the US, either as a British colony with independent legislative authority or an independent country, would have been broader in several areas because the laws would not have been constrained by the US Constitution. A former, non-US New York government might have been able to pass laws restricting the right of citizens to petition for a redress of grievances or pass a law providing that defendants in criminal court do not have the right to confront and cross-examine their accusers without these laws being struck down.

But were state laws really constrained a whole lot by the US constitution at the time? There wasn’t a whole lot in the way of federal judicial review for a while. There was no 14th Amendment or incorporation, so the bill of rights didn’t really mean a whole lot.

http://www.holocaust-trc.org/homosx.htm

To begin with, the number of political prisoners in East Germany in 1989 wasn’t all that big: The West German government had a policy of paying the East German government to set free political prisoners. All in all, 3.5 billion Deutsche Mark (hard capitalist cash) were paid over the decades to free 34,000 political prisoners and allow hundreds of thousands of East Germans to leave East Germany.

The Berlin wall fell on November 9th 1989. According to a news article, a gentleman named Peter Naundorf was the last political prisoner in East Germany. When the prison guard opened his prison cell on the morning of November 10th, the prison guard for the first time in more than 4 years addressed him politely as “Mister Naundorf” and didn’t just yell at him and call him by his last name.

Peter Naundorf was eventually freed 6 weeks later, he left the prison on December 22nd, 1989.

You could ask some Newfoundlanders, since they joined Canada within living memory, and the situation wasn’t complicated by the presence of political prisoners.

Spain had used the garrote as its method of capital punishment. The US didn’t immediately discontinue this after the Spanish-American War.

American military authorities in Puerto Rico also used the garotte to execute at least five convicted murderers in 1900. In a report to Congress, the American military governor opined “that execution by the garotte is far less inhumane and revolting than execution by hanging.”[6] However, use of this execution method was soon discontinued and replaced by hanging. (Since 1929, capital punishment has not existed under Puerto Rican law.)](Garrote - Wikipedia)

I don’t know that I entierly disagree with that governor. Some garrote devices had a spring-loaded spike that severed the spinal cord, that was triggered when the strangulation crank reached a certain point. That was better than the iffy placement of the noose and miscalulation of the drop chart.

I would imagine that when a group suddenly finds itself in charge, there are hundreds of issues to be addressed. Think of the US occupation of Iraq - they fired all the police and army. In hindsight, that did not turn out well, but if it included prison guards (I assume it did - and nobody was getting paid?) odds are they unlocked the cells before leaving.

The US position in Iraq was to mainly fire almost everyone, and forbid hiring of Baath party members. Apparently, though, if you wanted a decent career with the civil service, you pretty much had to be a party member - so a vast majority of the educated professional class were suddenly made ineligible to work for the new regime…

OTOH, when the Allies took over Germany, they left a lot of the civil service infrastructure in place and simply began their cleanup over top of that. There were many complaints that this policy left a lot of Nazi party people in important posts like mayor and police chief, thus intimidating people who might come forward with requests for change.

So “what about prisoners” is the least of a thousand issues - do we keep the civil service, which branches, how will we weed out the crony and patronage employees, what about government contracts, school curiculum, can we reprint the money to get that face off the bills, to what extend will we revisit legal and financial transactions of the old regime? Do we need a truth and reconcilliation committee? How many mayors and councillors in how many cities? Do we simply appoint replacement mayors until things settle down? If you fire the police, judges, and prosecutors and start from scratch it will be a mess. Some of them are the secret police, but some do chase down thieves and troublemakers; you lose that expertise.

the obvious start is to appoint a committee to examine each prisoner’s record adn work their way through; and/or have a process where the prisoners’ lawyers can also petition. Certain crimes might call for immediate freedom, but as pointed out earlier - many regimes would convict dissidents of other less political-sounding crimes. IIRC, “Hooliganism” was a common charge for dissidents in the USSR.