Baltimore City State's Attorney Marilyn J. Mosby is 35 years old and has only been in office since January. The Washington Post’s John Woodrow Cox explains who she is and the critical role she has in prosecuting the six police officers charged in connection with the death of Freddie Gray. (Jhaan Elker/The Washington Post)

Not long before Baltimore State’s Attorney Marilyn J. Mosby shocked the nation Friday with her decision to charge the six officers involved in Freddie Gray’s arrest, she texted her mother.

“Heads up,” she wrote. “National media is focusing on me.”

“You’ll be all right,” Linda Thompson said she replied.

“I know,” her daughter responded.

That confidence was on full display as Mosby — who is just 35 and has been on the job for less than four months — stood on the Baltimore War Memorial’s steps and methodically detailed the case against the officers. With a vigor seldom seen from officials handling the aftermath of Gray’s death, Mosby’s 16-minute statement suddenly made her a star on television and social media, a champion to those who have demanded justice for Gray and a source of outrage to police, who questioned the swiftness of her decision and her motives for bypassing a grand jury.

Gray, 25, died April 19, a week after suffering a severe spine injury while in police custody. His death has touched off days of unrest in Baltimore.

Mosby, a political novice and the African American daughter and granddaughter of police officers, ousted a white incumbent in last year’s Democratic primary by promising to hold police accountable. She echoed that sentiment Friday as she talked about Gray’s relatives.

“I assured the family,” she said, “that no one was above the law.”

Along with a deluge of praise came a barrage of criticism.

Among the raps: She has little experience prosecuting homicides or police misconduct, according to two Baltimore defense lawyers, one of whom worked with Mosby during her five years as an assistant state’s attorney. Efforts to reach Mosby for comment on Friday afternoon were unsuccessful.

Michael Davey, an attorney for the Fraternal Order of Police in Baltimore, called Friday’s charges an “egregious rush to judgment.” He expressed skepticism that the investigation could be completed in two weeks when it involves six officers and charges that range from misconduct in office to second-degree murder.

Gene Ryan, a police union leader, called for Mosby to appoint a special prosecutor, citing in a letter “the many conflicts of interest presented by your office conducting an investigation in this case.”

He pointed to Mosby’s relationship with William H. “Billy” Murphy Jr., the attorney for Gray’s family. On Friday night, Murphy said her decision to file charges “has given the family hope.”

Murphy raised money for Mosby’s campaign and was a member of her transition team, according to Ivan Bates, a former prosecutor and longtime Baltimore defense lawyer. Maryland campaign finance records show Murphy contributed $5,000 to her campaign.

The police union also donated to Mosby, giving her $3,250, records show.

Ryan’s letter also focused on Mosby’s husband, Nick, a member of the Baltimore City Council who represents the West Baltimore neighborhood where Gray was arrested. His political future, the letter said, “will be directly impacted, for better or worse, by the outcome of your investigation.”

At her news conference, Mosby was asked whether her husband’s job presented any potential conflicts. She sharply denied that any existed.

Former Baltimore mayor Kurt L. Schmoke (D), who served on Mosby’s transition team, dismissed the criticism.

“The call for her to step aside is misguided,” said Schmoke, a former state’s attorney and now president of the University of Baltimore. “There is no basis in fact to question her integrity or independence in this matter.”

Mosby, who has two young daughters, comes from a family steeped in law enforcement experience. Her mother, her grandfather and two of her uncles were police officers in Boston.

“She always wanted to be an attorney and work for the community,” said Thompson, her mother. “The world’s her stage right now, and she’s shining like a star.”

Mosby grew up in Boston and knew by age 6 that she wanted a career in law.

After Mosby badly cut her knee in a yard littered with broken glass, her mother sued the landlord. On their day in court, the judge looked down at the youngster.

“Hi, little girl,” her mother remembered the judge saying. “What do you want to be when you grow up?”

Mosby didn’t hesitate: “A judge.”

Her interest in the law intensified when a 17-year-old cousin was shot and killed as he sat on a bike in the driveway of their grandparents’ Boston home in 1994.

The slaying of Diron Spence — apparently a case of mistaken identity — captivated Boston and stunned Mosby, who was 14. In past interviews, she has said it helped motivate her to become a lawyer.

Thompson, who was 17 when Mosby was born, raised her daughter as a single mother, with help from her parents.

Mosby grew up in a largely black, working-class Boston neighborhood. She was bused to a mostly white school, where she occasionally faced racism, her mother said, but also learned to adapt.

She was bright and always strong-willed. “She would think she could tell me what to do at times,” Thompson said. “And she still does at times. I have to put her in check.”

Thompson bought her daughter books on black history, and Mosby read them voraciously. Supreme Court Justice Thurgood Marshall, who grew up in the same neighborhood as Freddie Gray, became a role model.

Mosby’s late grandfather, who was a policeman for more than two decades, functioned as a father figure.

“He was the daddy she didn’t have,” Thompson said. “He was a big man with a big heart.”

Mosby attended Tuskegee University in Alabama, where she met her husband. After graduation, she applied to Boston College Law School but was initially rejected.

Thompson encouraged her to look elsewhere, but Mosby wrote e-mails, letters and called — daily — until she was admitted.

She went on to clerk at U.S. attorney’s offices in Boston and Washington, then joined the Baltimore state’s attorney’s office as a law clerk in 2005 and moved up the ranks. She left at the end of 2011 to work for an insurance company.

Douglas F. Gansler, then Maryland’s attorney general, wanted to hire Mosby to investigate insurance cases. To his surprise, she turned him down to run for office.

She took on the incumbent state’s attorney, Greg Bernstein, who raised three times as much money as she did. But her campaign’s focus on the city’s persistently high murder rate and police misconduct allegations resonated with voters.

The day after she was inaugurated on Jan. 8, she brought manslaughter charges against a top Episcopal bishop accused of hitting a bicyclist while driving under the influence of alcohol and texting while driving.

Mosby moved the case against Heather Elizabeth Cook from District Court, where it was a traffic matter, to circuit court, where she was charged with manslaughter in the death of Thomas Palermo, a father of two. Cook was defrocked this week. A trial on the manslaughter charge has been set for June.

But Gray’s death represents her biggest test in office.

A week ago, her 77-year-old grandmother, also named Marilyn, asked Mosby what she felt about the case.

“You can’t go on your feelings,” she recalled Mosby saying. “You have to go on the evidence.”

Del. Jill P. Carter (D-Baltimore) said the nerve Mosby showed Friday will quiet those who doubted her experience.

“Anybody who had questions about her readiness or preparedness for the job, she showed that she is competent and capable,” Carter said. “There is always a tendency to underestimate the young, a woman, a black woman.”

Carl Stokes, who serves with Mosby’s husband on the City Council, said the case has placed the young state’s attorney on a national stage. How high she rises, he said, will depend on the case’s outcome.

“Now she has to show her office can handle the prosecution,” Stokes (D) said, “so at the end of the day we have a conviction.”

But on Friday night, at the West Baltimore intersection where riots exploded, Massieka Holness joined an exultant crowd focused only on celebrating the charges and a belief that justice was served. The 32-year-old bartender held up a piece of cardboard with a message written in black marker: “Marilyn Mosby 4 Mayor.”