(CNN) -- After killing nine black parishioners at a Charleston church, Dylann Roof drove more than 20 miles and stopped at a second African-American church, according to newly unsealed court documents.
GPS data obtained by officers showed that after the shooting at the Emanuel African Methodist Episcopal Church, Roof drove directly to the Branch AME Church in Summerville, South Carolina.
The Branch AME Church had also been scheduled to have Bible study on the night of June 17, 2015.
Roof slowed down in his car as he approached the church. His GPS device deactivated for approximately two to three minutes, which is consistent with stopping the car, according to prosecutors.
They noted similarities between Emanuel AME and Branch AME, as both churches have predominantly black congregations and held Bible studies on Wednesday nights.
Roof, who was armed, drove to the second church, which "supports the inference that Defendant intended to continue his racially motivated violence at Branch AME Church that night and, more specifically, that his intended targets were African-American congregants at a church," prosecutors stated in the court document filed in September.
The Bible study at Branch AME had been canceled that night, the church's Rev. Rufus Berry told the Post and Courier newspaper. Even if the gathering hadn't been canceled, it would've been over by the time Roof arrived, he said. But Berry told the Charleston newspaper that he was unsettled by the news.
Research on other black churches
The GPS data suggested it wasn't the first time Roof had gone near Branch AME Church. He had driven past the same church four months before, according to prosecutors.
After his arrest, Roof told officers that he had researched other black churches. He told them that he considered several targets including a "black festival" before deciding to attack Emanuel AME.
Investigators also found a handwritten list of mostly black churches, which included addresses, phone numbers and hours of worship.
Second church didn't come up during trial
Roof's defense attorneys sought to exclude the GPS data along with two photographs of the Branch AME Church from trial. They argued the evidence was "irrelevant," and Roof had driven past the church.
But prosecutors argued there is "no commercial activity on the road where Branch AME is located that would otherwise prompted Defendant to stop at that location," in court documents.
The GPS data was not presented during his trial.
Roof, a white supremacist, was found guilty on of all 33 federal charges and sentenced to death. He is the first person to get the death penalty for a federal hate crime.
He also faces state murder charges.