HOUSTON — Rep. Gabrielle Giffords was resting in an intensive care unit Thursday after undergoing surgery to restore a large piece of her cranium with a ceramic prosthesis and install a permanent tube to drain fluid from her skull.

The surgery marked an important milestone in Giffords’ recovery from an assassination attempt in a Tucson, Ariz., supermarket parking lot Jan. 8. A gunman shot her in the forehead as she met with constituents, in a rampage that left six dead, among them a federal judge and a 9-year-old girl.

Speaking at a news conference at Memorial Hermann-Texas Medical Center on Thursday morning, her neurosurgeon, Dr. Dong Kim, called Giffords’ progress “almost miraculous” but quickly added that he could not predict if or when she would return to work. An eloquent speaker before the shooting, Giffords has had to relearn that skill, as well as the basics of walking, standing, sitting and climbing stairs.

The surgery Wednesday took 3﻿1/2 hours and involved grafting a ceramic piece shaped by a computer to fit the part of her skull that was removed to relieve swelling after her injury, Kim said. He said her doctors had opted for a prosthesis because the original bone was shattered and contaminated by the bullet. He also revealed that some fragments of the bullet remained in her brain and could not be safely removed.

The procedure was performed at Memorial Hermann while the congresswoman’s husband, astronaut Mark Kelly, was orbiting above Earth as captain of the space shuttle Endeavour. Kelly’s decision to go ahead with his mission during his wife’s recovery has become a conversation topic at kitchen tables across the country. Kim said he and Kelly had decided in advance that the surgery would be done when conditions were optimal.

“Obviously, this has been a long road since Jan. 8 for us,” Kelly told an interviewer with “PBS NewsHour” on Thursday, speaking over a radio link from space. “Her having surgery yesterday was not planned all along, but she was ready and the doctors wanted to do it then and it didn’t make sense to wait a couple of weeks until I got back. So I’ve been thinking a little bit about that, but it’s pretty common surgery and it went really well.”

Otto Warmbier was arrested in January 2016 at the end of a brief tourist visit to North Korea. He had been medically evacuated and was being treated at the University of Cincinnati Medical Center when he died at age 22.