ROCKVILLE, Md. — Melania Trump talked up the importance of teaching children positive cyber habits Monday on the same morning that her husband sent tweets deriding current and former U.S. officials, including one message referring to a former CIA director as a "political hack."

Asked about the contradictory messages, the first lady's office said in a statement that she "is aware of the criticism but it will not deter her from doing what she feels is right. The President is proud of her commitment to children and encourages her in all that she does."

Mrs. Trump delivered brief remarks to help open a government-sponsored summit called Federal Partners on Bullying Prevention, encouraging social media and technology companies to provide more opportunities for young people to share ideas for how to be good citizens online.

But the split screen of the first lady encouraging children to act a certain way when they see President Donald Trump behaving in the opposite way underscored the challenge Mrs. Trump faces with her "Be Best" campaign. A key focus is on youth cyberbullying.

Mrs. Trump spoke highly of a group of students she recently met who participate in Microsoft's Council for Digital Good. The students provide the computer software maker with ideas and feedback for Microsoft's policy work on youth-centered online safety.

She told the summit at the Health Resources and Services Administration building in Rockville how impressed she was by their "deep understanding of how important it is to be safe" and said she was "inspired by their sincere commitment to reducing peer-to-peer bullying through kindness and open communication."

"I encourage technology and social media companies, schools and community groups, to establish more opportunities for children such as Microsoft's Council for Digital Good," the first lady said. "By listening to children's ideas and concerns, I believe adults will be better able to help them navigate this often-difficult topic."

"Let's face it: Most children are more aware of the benefits and pitfalls of social media than some adults, but we still need to do all we can to provide them with information and tools for successful and safe online habits."

After speaking, Mrs. Trump took a seat in the front row and listened as a panel featuring representatives from Facebook, Google, Twitter and the nonprofit Family Online Safety Institute talk about how they're responding to the issue.

As the panelists spoke, Trump sent fresh tweets about John Brennan, calling him "the worst CIA Director in our country's history" and a "political hack." Brennan, who led the CIA under President Barack Obama, a Democrat, has been an outspoken critic of Trump, a Republican, over his performance and behavior as president. Trump recently revoked Brennan's security clearance.

Trump also tweeted against Justice Department official Bruce Ohr, who has come under Republican scrutiny for his contacts to Glenn Simpson, co-founder of Fusion GPS. The opposition research firm hired former British spy Christopher Steele during the 2016 presidential campaign to compile a dossier on Trump and his Russia ties. Ohr's wife, Nellie, worked for Fusion GPS during the campaign — and Trump has been tweeting about the connection to highlight his assertions of political bias behind the Russia investigation.

Trump tweeted Monday: "Will Bruce Ohr, whose family received big money for helping to create the phony, dirty and discredited Dossier, ever be fired from the Jeff Sessions "Justice" Department? A total joke!"

Trump said last week that he was close to revoking Ohr's security clearance, too.

The first lady's appearance at the conference came as part of her campaign to help children "Be Best," which also includes an emphasis on child well-being overall and opioid addition.

Health and Human Services Secretary Alex Azar said the Health Resources and Services Administration, which sponsored the conference and which his department oversees, began an anti-bullying campaign in 2001 to help raise awareness. He said one in five children experience bullying, and that 16 percent of children currently are victims of cyberbullying.

"We need to recognize that bullying is bullying wherever it occurs," Azar said. "And we need to stop it."

The conference also heard from Joseph Grunwald, who described his experiences being bullied during middle and high school. Grunwald said the bullying started as taunts on the school bus and grew into physical harassment by high school, including violence. He did not go into detail.

As the same time, he said he was also being harassed on social media.

"Because the bullying was also online, I couldn't escape it, no matter where I was," Grunwald said.