MADRID — After decades on the run, a notorious Spanish far-right terrorist was returned to a prison outside Madrid on Friday, following his extradition from Brazil.

Carlos García Juliá was an architect of one of Spain’s most high-profile political killings, known as the 1977 Atocha massacre. The attack, carried out on the Madrid offices of a law firm working for a labor union linked to the Communist Party, killed five people.

At the time, just over a year after the death of the dictator Francisco Franco, Spain was navigating uncharted political territory as it struggled to confirm its return to democracy. The Communist Party, which had been declared illegal during the lengthy Franco dictatorship, was at the time negotiating whether to end decades of clandestine opposition and return to mainstream politics.

Mr. García Juliá, who was 24 at the time of the attack, was a fascist militant affiliated with a newly founded party called Fuerza Nueva, or New Force, determined to keep Spain under a totalitarian regime despite the death of the dictator.