Media playback is unsupported on your device Media caption Inside Guantanamo Bay

The commander in charge of the military prison at Guantanamo Bay has been dismissed just seven weeks before he was due to leave the post.

Navy Rear Admiral John Ring was fired due to a "loss of confidence in his ability to command," according to the US Southern Command.

Rear Adm Ring will be temporarily assigned elsewhere in the Southern Command, which oversees the prison.

His deputy, Army Brig General John Hussey, will serve as acting commander.

"This change in leadership will not interrupt the safe, humane, legal care and custody provided to the detainee population at GTMO," a statement from Southern Command said.

Image copyright Reuters Image caption Rear Adm Ring began his post at Guantanamo Bay in April 2018

No further details on reasons behind the dismissal were provided.

The firing was first reported by the New York Times in partnership with the Pulitzer Center for Crisis Reporting.

Col Amanda Azubuike, a spokeswoman for the Southern Command, told the Times that the firing was unrelated to a recent media visit hosted by Rear Adm Ring, but was the result of a month-long investigation into the commander, opened in March.

Speaking out of turn?

Analysis by Tara McKelvey, BBC White House Reporter

Last week Rear Adm Ring spoke with reporters about the Geneva Conventions, which state that detainees must receive the same level of care that military personnel are offered.

"But if a trooper got sick, I'd send him home to the US," Rear Adm Ring said.

The same kindness is not extended to the detainees, however, as Rear Adm Ring made clear in his remarks.

US law does not allow detainees to be transported to the mainland. Yet many of them are older - at least one is in his 70s - and suffer from cancer, diabetes and other diseases, the kind that can be treated more easily in hospitals on the mainland.

By discussing the challenges of providing medical care for the detainees, Rear Adm Ring waded into a contentious area: whether the detainees should receive treatment solely on the island (with equipment shipped in - at vast expense) or be sent to the US where they can be treated in hospitals.

Many Republican lawmakers support a tough national security policy and believe that Guantanamo is crucial to ensuring that the homeland is protected.

They do not want detainees transferred to the US and have blocked attempts to bring them here - whether for medical care or other reasons. Democrats and human-rights advocates disagree, arguing that detainees should be transferred out of Guantanamo and receive decent medical care.

As Roger Williams University's Peter Margulies says: "I don't know why Admiral Ring was fired. But it does send a bad message to relieve someone of their duty when they have raised this issue, one that the government desperately needs to address."

Rear Adm Ring began his assignment at Guantanamo in April 2018 and was due for replacement in a routine rotation the week of 11 June, according to the Times.

"The vast majority of commanders complete their assigned tours with distinction", Col Azubuike said in a statement provided to US media.

"When they fall short, we hold our leaders accountable, which reflects the importance we place on the public's trust and confidence in our military leaders."

He was the 18th person to occupy the post since prison operations began in January 2002.

Image caption The prison Cuba has used since the 9/11 attacks to detain what Washington calls "enemy combatants" though only 40 detainees currently remain.

The facility in Cuba has been used since the 9/11 attacks to detain what Washington calls "enemy combatants." More than 700 prisoners have been held there since, though only 40 detainees remain.

In his position at the military prison, Rear Adm Ring was responsible for the remaining prisoners and a staff of 1,800 troops and civilian employees.

In January 2018, US President Donald Trump signed an executive order to keep Guantanamo Bay's prison open.

The decision marked a reversal from former President Barack Obama, who said he wanted to close the controversial site "as soon as practicable."