As mortally wounded NYPD cop Wenjian Liu lay in a Brooklyn hospital in 2014, doctors asked his stricken wife if she wanted his semen preserved so that she might someday have his child.

“Of course she said yes,’’ a friend told The Post — and Tuesday, two-and-a-half years after Liu’s murder, his widow gave birth to their daughter.

Liu’s widow, Pei “Sanny’’ Xia Chen, named the baby “Angel’’ as a tribute to her slain hero husband — whose police hat is now next to her bed at New York-Presbyterian Hospital on the Upper East Side, said the pal, fellow cop widow Maria Dziergowski.

The day Chen was artificially inseminated, “she had a dream that Wenjian was there in a white gown looking like an angel and that he handed her a baby, and he said, ‘It’s a girl, a little angel,’ ’’ Dziergowski said.

“So [Chen] knew before everyone that it was a girl.

“The baby’s adorable, smiling, laughing,’’ added Dziergowski, who was with Chen at the hospital Tuesday. “She has a lot of hair, a lot of black hair.’’

Chen — who had only been married to her policeman husband for three months before he and his partner were killed in an ambush by a cop-hating madman — was admitted to the hospital around 12:30 p.m. Monday and gave birth at 4:35 a.m., Dziergowski said.

The baby, whose full name is Angelina, weighed 6 pounds, 13 ounces and is 19.5 inches long, Dziergowski said.

Sources said the baby’s birth was particularly poignant for Liu’s parents, who lost their only son, 32, in the double murder.

Liu’s dad and mom, who live in Brooklyn, went to the hospital to see their new granddaughter hours after her birth, Dziergowski said.

“The parents were very emotional, crying and holding the baby,” she said.

Read more about Officer Liu and his daughter’s unusual birth on the New York Post