A US soldier's wife who was detained by immigration agents at the military base where he is stationed - just days after their wedding - has been released.

Annie Ramos, 22, an undocumented immigrant who came to the US as a toddler, was arrested on 2 April and spent five days at a detention centre alongside hundreds facing deportation under the Trump administration's immigration crackdown.

Immigration officials described Ramos as an illegal alien from Honduras who was arrested after attempting to enter a military base.

I feel awesome. Relieved. Relieved, Staff Sergeant Matthew Blank told the New York Times after his wife's release. These have been the worst days of my life.

I can't wait to carry my wife into our home and start our lives together, Blank told the newspaper, which first reported the story. I'm complete and ready to serve our country. And it's her country, too.

Blank, who enlisted more than five years ago and has served in the Middle East and Europe, is scheduled to begin training later this month ahead of another deployment.

Ramos, a biochemistry student, said she was focused now on securing her status, continuing her studies, and building a life with her husband.

All I have ever wanted is to live with dignity in the country I have called home since I was a baby, she said in a statement to the BBC. I want to finish my degree, continue my education, and serve my community - just as my husband serves our country with honor.

The Department of Homeland Security has said that Ramos has no legal status to be in this country.

DHS officials did not respond to questions about her status when contacted on Tuesday by the BBC.

The couple had travelled from Houston to the Louisiana base to obtain a military ID for Ramos and activate her military spouse benefits, with plans to move her onto the base over Easter weekend.

Instead, Blank said, she was ripped away from him last week.

During an appointment at the base, the couple presented Ramos's birth certificate, Honduran passport, their marriage license and Blank's military identification.

I never imagined that trying to do the right thing would lead to her being taken away from me, Blank earlier told the BBC. What was supposed to be the happiest week of our lives has turned into one of the hardest.

Ramos was placed in handcuffs by Immigration and Customs Enforcement (ICE) agents before being driven away in a military vehicle.

As family members frantically tried to contact immigration officials to ensure that Ramos was not deported, Senator Mark Kelly of Arizona, where the sergeant's family is from, contacted Blank to tell him he would push for Ramos' release.

Officials said that Ramos entered the US illegally in 2005 and was issued a final removal order after failing to appear at an immigration hearing. She was about 22 months old at the time.

Legal experts told CBS News, the BBC's US media partner, that the administration has moved away from past practice of leniency towards the families of service members in immigration cases.

The detention has also drawn criticism from advocates, who say it risks undermining morale among service members.

Gaby Pacheco, president of TheDream.US, an organisation that provides scholarships to undocumented immigrants, told the BBC that the case should serve as a wake-up call.

Detaining a 22-year-old biochemistry student who has lived here for two decades and is married to a U.S. Army staff sergeant preparing for deployment doesn't make us safer – it weakens a military family, undermines our basic values, and exposes how far we've fallen as a nation, she said.