WASHINGTON — In the months before Kirstjen Nielsen was forced to resign, she tried to focus the White House on one of her highest priorities as homeland security secretary: preparing for new and different Russian forms of interference in the 2020 election.

President Trump’s chief of staff told her not to bring it up in front of the president.

Ms. Nielsen left the Department of Homeland Security early this month after a tumultuous 16-month tenure and tensions with the White House. Officials said she had become increasingly concerned about Russia’s continued activity in the United States during and after the 2018 midterm elections — ranging from its search for new techniques to divide Americans using social media, to experiments by hackers, to rerouting internet traffic and infiltrating power grids.

But in a meeting this year, Mick Mulvaney, the White House chief of staff, made it clear that Mr. Trump still equated any public discussion of malign Russian election activity with questions about the legitimacy of his victory. According to one senior administration official, Mr. Mulvaney said it “wasn’t a great subject and should be kept below his level.”

[Update: F.B.I. warns of Russian interference in 2020 election and boosts counterintelligence operations.]