It was after midnight, and Narges Shafeirad was driving down a dark suburban road north of Washington, D.C. In 12 hours, she was due in court for the final hearing in a bitter divorce and custody case.

With her was the couple's 5-year-old son Daniel.

"We believe," prosecutor Marybeth Ayres said Thursday, "that she didn't want to give the dad what he wanted."

On Thursday, Shafeirad pleaded guilty in Montgomery County Circuit Court to killing Daniel last year by forcing him to swallow a lethal amount of cold medicine before setting her car on fire and staging a crash to mask her brutality. She faces up to 50 years in prison at her sentencing in December.

"This was a tragedy from every angle," said Melanie Creedon, Shafeirad's attorney. "She truly loved her son.

Shafeirad showed little outward emotion as details of her crime were read in court as part of her guilty plea. She stared straight ahead, blinking and occasionally wiping her eyes.

Daniel was forced to ingest at least 338 milligrams of diphenhydramine - the active ingredient in drugs such as Benadryl.

The amount was more than would be in an entire bottle of medicine and a dose that would have been lethal to anyone.

"Daniel had two-and-a-half times the concentration of diphenhydramine in his heart-blood than what would kill an adult," Ayres said.

At some point on the night of the murder, Shafeirad wedged her son's body behind the front seat on the rear floorboard of her 1993 Toyota Corolla. It's unclear when Daniel died, but the killing happened before Shafeirad doused the inside of the car with gasoline and ignited it.

Speaking with detectives, she insisted that she and Daniel had been on their way to the beach in June of last year and that she had gasoline with her as a precaution in case she could not find an open gas station.

"She stated that while driving with the bottles of gasoline in the car to Ocean City, she lit a cigarette and the car started on fire," Ayres said.

Shafeirad was charged in July last year with first-degree murder and first-degree arson. She had been facing a jury trial in September.

The child's father was not in court Thursday and could not be reached.

In an interview last year, David Gavin, who was then representing Daniel's father, Hamid Azimi-Dana, said: "Daniel was the beginning and end of his life. He is saddened beyond words."

As she pleaded guilty Thursday, neither Shafeirad nor her attorneys explained why she killed the bright, curious young boy. Some of that information is expected to be aired during her sentencing hearing.

Court records - both for her divorce and the murder case - capture pieces of Shafeirad's history.

She was born in Iran, where she met Azimi-Dana, who had immigrated to the United States but made trips back home. He ran a business in Maryland that supplied produce to Middle Eastern restaurants. In court, Shafeirad said she is 35 but would be 34 according to dates in her arrest and marriage records.

The couple were married in Tehran on Dec. 17, 2007, according to court records. Daniel was born July 21, 2009. By July 2011, all three family members were living in Gaithersburg, Maryland.

But the marriage was troubled. In June 2013, the couple separated. A month later, Shafeirad and Azimi-Dana filed requests for restraining orders against each other - with each alleging in court filings that the other had physically abused them in front of their son.

Azimi-Dana stated that on June 19, 2013, as they drove home from dinner, Shafeirad started yelling and punching him. When they got home, he alleged, she attacked him while he was holding Daniel. "She screamed that she was going to kill me while I slept in my bed," Azimi-Dana wrote. He said he didn't call the police because he didn't want to upset Daniel.

Shafeirad and Azimi-Dana agreed to stay away from each other without admitting to the alleged abuse. A joint custody arrangement was worked out for Daniel, who stayed with his mother four days a week and his father three days a week, according to court documents.

With limited command of English, Shafeirad got a job looking after an older Iranian immigrant, according to information in the divorce case.

Her living situation, according to statements she would later give to detectives, grew desperate.

On June 15, 2015, her lease expired on her residence, and she moved out without enough money to find a new place to live.

That same day, she picked up Daniel after school, who was healthy and showed no signs of sickness, his kindergarten teacher would later tell police.

Shafeirad told detectives she and her son went to several restaurants in the Rio area of Gaithersburg. Daniel spoke of spending time with his father.

"He told her that he had just spent the weekend having a great time with his dad at an amusement park," Ayres said in court.

At some point that night, according to authorities, Shafeirad forced Daniel to ingest the medication. Ayres listed injuries to Daniel's cheek, lips and the inside of his mouth, suggesting he struggled against swallowing it. The large volume of the medicine would have left the boy confused, unable to stand and with seizures and blurry vision, said Ayres, recounting the symptoms outlined by an expert witness that prosecutors had lined up to testify at trial.

Dissecting how Shafeirad staged the crash, investigators determined that she had pulled off the highway, carefully avoiding trees before parking her Toyota.

Probing how the fire began, arson investigators concluded there was no damage to the car's mechanical components and no damage to the fuel lines or transmission lines.

The gasoline had been spread inside, splashing Daniel's clothes and his Spider-Man backpack.