(CNN) -- The woman wore a nurse's uniform when she walked into the maternity ward.
She left the hospital driving away in a red car with a sign that said "Baby on Board."
Police say there was a baby inside the Toyota Yaris the 21-year-old was driving Monday evening as she left the hospital in Trois-Rivières, Quebec.
But the little girl wasn't hers.
At the hospital, baby Victoria's parents were frantic.
Their child was only 16 hours old when she was abducted, mother Mélissa McMahon said in a Facebook post describing the ordeal.
"The worst case scenarios played out over and over in our heads," she wrote. "Unfortunately, the endings are not often happy, above all in this type of case."
But just a few hours after the baby went missing, authorities returned her to her parents.
Thanks to "four marvelous people," McMahon wrote, and "thanks to Facebook."
"It is the only reason that explains why Victoria is in my arms at this time," she said.
Amber Alert goes viral
Publicity about Victoria's disappearance started with an Amber Alert sent out by Quebec police.
In social media posts, messages from police described the vehicle and the woman driving it. The newborn, police said, was wrapped in a blue blanket.
It wasn't long before the alert and a photo went viral.
A group of four friends spotted it on Facebook when they were hanging out on Monday night, Canadian media reported.
"We just wanted to do something for the night, so we went out to find the car," Charlène Plante told Canada's CTV network.
When police released a photo of a woman wearing scrubs in the hospital, Plante said she immediately recognized her former neighbor.
The friends drove to the woman's apartment and saw the car parked outside.
"The patio door was open. The lights were on," Mélizanne Bergeron told Canadian public broadcaster CBC. "It was clear that she was there."
Then, they called police. Officers were there within minutes, Plante said, kicking down the apartment door. The baby was recovered and a woman was taken into custody.
"After the baby was in the hands of the police, it was the best moment in my life," Bergeron told CTV. "We were crying."
On Facebook, she posted a video showing her tearful friends as a police officer appeared in the apartment building's stairwell, the baby safe in his arms.
Woman in custody
Quebec police spokeswoman Christine Coulombe wouldn't confirm details about how the baby was found, but she said police received tips from the public after publicizing the case on social media.
The woman was hospitalized for evaluation and was on 24-hour police watch, but she had not met yet with investigators Tuesday, Coulombe said.
It is not known whether there was any previous link between the woman and the baby's family, she said.
In a statement, the hospital from where the baby was taken thanked police investigators and said a team of risk-assessment experts would be analyzing the circumstances surrounding the incident and making recommendations about whether any changes are needed. Details from the police investigation will also be part of that analysis, the hospital said.
"At this time, it is difficult to discuss in more detail the situation without revealing specific elements that could harm the investigation and court proceedings," the Center for Health and Social Services of Trois-Rivières said in a statement. "The establishment will therefore be reserved in public statements in the coming days."
Daniel Cossette, the baby's uncle, told CTV that he spoke with the woman in the nurse's uniform as she walked down the hospital hallway with the newborn in her arms. She told him she was taking the baby for routine tests.
"She had the attitude, the uniform, all of it," he said, "and we never presumed she was a kidnapper."
'Every click, every share made the difference'
As authorities continue investigating, the baby's mother says she has no doubt about how Victoria ended up in her arms again.
Alert hospital staff realized quickly that the baby had been taken, she said. Fellow patients at the hospital provided details about the woman and her vehicle. Security guards tracked down a photo of the woman with help from police. And investigators sent out the Amber Alert and image very quickly.
"The photo saved our daughter! In less than an hour, the photo was everywhere...You were more than thousands of people who shared the photo of this woman on social media. ... Know that it was this that saved her, our little Victoria. Every click, every share made the difference," McMahon wrote in a message thanking people for their support.
But along with her thank-you message, she also sent a word of caution to other mothers, saying that her experience with the woman dressed as a nurse should be a warning.
"Never allow yourself to be influenced by a uniform....I know that it can seem trivial, but if I had been more skeptical, all of this could have been avoided....Verify the badge of the nurse...ask questions...it is your child, don't let them out of your sight," she wrote. "I would not like anyone else to live this."
She did not describe further details about any interaction with the woman.
As for her baby, McMahon said "little Victoria wears her name well for this victory."
"To give life to our child is an incredible moment," she wrote, "but finding our child safe and sound is an indescribable feeling."
Her post had been shared more than 18,000 times on Facebook by Tuesday night.