In his first ruling, Johansen mentioned research that said children do better when raised by heterosexual families and that "same-sex marriages have double the rate of instability as heterosexual marriages."
That language was crossed out in Johansen's new order. It now says the court merely cited concerns that research has shown children are more emotionally and mentally stable when raised by a mother and father in the same home.
The American Psychological Association has said there's no scientific basis that gay couples are unfit parents based on sexual orientation.
Jim Hunnicutt, a lawyer for the couple, said they are happy the judge rescinded the order so quickly.
"These two people are excellent, wonderful parents," he said. "They love the child every much, and they are very optimistic that the child will remain in their care."
Hunnicutt said he didn't know what caused the judge to change his mind but that the initial decision violated the Constitution and harmed the baby.
"What I have to assume is that when the law was put right in front of his face, he realized that he had made a mistake, and he wanted to correct it and do the right thing and do what was constitutional," the attorney said.
Hunnicutt said his clients were shocked and angry after Tuesday's hearing but were encouraged by the outpouring of support from around the country in the days since.
Child welfare officials are working to keep the family together and hope that the public outcry surrounding the case sends a strong message to the judge, Sumner said.
"We're really happy for this family, and we want to see them stay together," she added.
Hoagland, a stay-at-home mother, and Peirce, a paramedic, are among a group of same-sex married couples who were allowed to become foster parents in Utah after last summer's U.S. Supreme Court ruling that made gay marriage legal across the country. State officials don't keep an exact count but estimate there are a dozen or more foster parents who are married same-sex couples.
A full transcript of Johansen's initial ruling has not been made public and may not be because court records of cases involving foster children are kept private to protect the kids involved. Johansen is precluded by judicial rules from discussing pending cases, Utah courts spokeswoman Nancy Volmer has said.
The move to take the baby away generated widespread criticism, including from national gay rights groups and Utah Gov. Gary Herbert.
Herbert said Thursday that Johansen should follow the law and not inject his personal beliefs into the decision. Groups including the Anti-Defamation League, Human Rights Campaign and the American Civil Liberties Union called the order shocking, outrageous and unjust.