The national anthem has been used to protest against injustice, but Keke Palmer took it as an opportunity to honor her ancestors ... telling TMZ Sports she sang the "Star-Spangled Banner" at the World Series to show respect for those who came before her.
The anthem has been quite the hot topic in recent years ... from Colin Kaepernick's kneeling protest to lyrics mentioning slavery in the third verse.
We spoke with the 28-year-old singer/actress fresh off her anthem performance prior to Game 1 in Houston on Tuesday ... and she said taking part in the tradition was an easy decision.
"I just feel like my ancestors built this country," Palmer told us at LAX on Wednesday.
"So, I show love for their lives that were taken. I stand on this ground because they couldn't stand in certain places."
"For me, that's what it's about, you know, they built the country. They deserve their respect."
Palmer -- who's been a strong advocate for social justice -- says the gig was incredible despite the controversy around the song ... and also served as a special way to honor her grandma, who recently passed away.
"She loved baseball so I was so happy to perform. I kinda felt like she was with me there."