Democratic U.S. Sen. Elizabeth Warren said Sunday that she changed her mind recently and took a DNA test proving her heritage because Americans' trust in government is "at an all-time low" and she wanted to help rebuild it by being transparent.

The incumbent Massachusetts senator spoke at her second debate against Republican state Rep. Geoff Diehl in the U.S. Senate race.

She was asked by a moderator why she had said, in March, that no DNA test was needed to prove she had some Native American heritage. She said she 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."

Diehl shot back that the issue "is not about Sen. 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," when she first mentioned having Native American heritage that led President Donald Trump to start mocking her by calling her "Pocahontas."

He added, "I don't care what percentage she claims to be Native American; I just care that I'm 100 percent for Massachusetts and will be working for the people of this state."

Trump's silent presence dominated the debate, with Diehl saying it's "obvious" she doesn't want to be senator, but rather, president. "She's been campaigning in states that are more important to her than Massachusetts," he said.

On Sunday, the two candidates also touched on the subjects of climate change, gun safety, health care 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 is 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 Nov. 6 midterm elections.

The debate, the second between Warren and Diehl in three days, was sponsored by the Western Massachusetts Media Consortium in the studios of WGBY-TV in Springfield and moderated by WGBY's Carrie Saldo.