Senator Elizabeth Warren, left, is seeking re-election in Massachusetts where she is opposed by the Republican Geoff Diehl.
Photograph: Michael Dwyer/AP

Elizabeth Warren said on Sunday that she changed her mind recently and took a DNA test to prove her heritage because Americans’ trust in government is “at an all-time low” and she wanted to help rebuild it.

The Massachusetts senator spoke at her second debate against the Republican Geoff Diehl. She was asked by a moderator why she said, in March, that no DNA test was needed to prove she had some Native American heritage.

Warren ultimately took the test, reporting the result last week that showed a relative six to 10 generations ago was Native American.

Ultimately, she said, she took a DNA test because she believes one way to rebuild trust in government is by posting her full family history online “so anybody can take a look. I believe one way that we try to rebuild confidence is through transparency.”

Sign up for the new US morning briefing

Diehl shot back that the issue “is not about Senator Warren’s ancestry, it’s about integrity in my mind, and I don’t care whether you think you benefited or not from that claim, it’s the fact that you tried to benefit from that claim that I think bothers a lot of people and it’s something you haven’t been able to put to rest since the 2012 campaign”.

That was when Warren first mentioned having Native American heritage, over which Donald Trump has mocked her by calling her “Pocahontas”.

Diehl added: “I don’t care what percentage she claims to be Native American; I just care that I’m 100% for Massachusetts and will be working for the people of this state.”

Trump’s silent presence dominated the debate, with Diehl saying it was “obvious” Warren does not want to be senator, but rather president in succession to Trump.

“She’s been campaigning in states that are more important to her than Massachusetts,” he said.

The two candidates also touched on the subjects of climate change, gun safety, healthcare and racism, with generally opposing views they have exchanged in the past. But a rather surprising topic on which they agreed was the legalization of marijuana, with both supporting the right of states to legalize it.

“I think this is a states’ rights issue,” Diehl said, adding that he was referring to medical and recreational marijuana. Warren has backed a federal bill that asks the government to cede to a state once it legalizes marijuana.

Warren, 69, is running for her second six-year term in the Senate and is a potential 2020 candidate for president. She has been a frequent critic of Trump. Diehl, 49, co-chaired Trump’s 2016 Massachusetts presidential campaign. Independent candidate Shiva Ayyadurai is also on the ballot for the 6 November midterm elections.