Roger Corman came up with the idea for the film during a visit to the dentist, when he read a magazine article about Dubrovnik. To take his mind off the pain while the dentist was working, he tried to create a story which could be filmed there. After leaving the dentist, he returned to his office and wrote the first treatment for the script.
This was Stewart Granger's first low-budget independent film after years of major starring roles, and he had concerns about allowing his character to be less than central to the story. During the filming on the Adriatic Sea, the production crew had already created the smoke for the scene when Granger told Roger Corman that he wouldn't do the scene as written because Edd Byrnes had too much dialogue and Granger's character was of lesser importance. Corman quickly wrote some new dialogue for Granger to satisfy his concerns (though he has declined to state how much of that dialogue made it into the finished film), and filming proceeded before the smoke dissipated.
This movie is considered to have beaten The Dirty Dozen (1967) in having the first film story about World War II prisoners recruited to go on an impossible suicide mission in exchange for pardons. "The Dirty Dozen" had the same plot but didn't come out until three years later.
Director Roger Corman once said of this film: "The odd thing about this movie is that it had a very similar plot to an old western of mine, Five Guns West (1955). It also came out before The Dirty Dozen (1967). I've heard stories that the producers of 'The Dirty Dozen' actually postponed production of their film an entire year because they realized that our story-lines were so similar."
Producer Roger Corman once described how this film came about: ". . . Bob Campbell [R. Wright Campbell], who had just done [The Young Racers (1963)] for me, had finished a script titled 'The Dubious Patriots'. Once again, the theme was one I liked very much: bad men sent to do good as a way to redeem themselves and win their freedom. In New York--on the way back from Racers--I gave Picker [David V. Picker] the script on a Friday and he said, 'We'll look at it. But we're backed up with scripts and it might be a few weeks before I can get to it.'" Picker rang Corman on Monday and the picture was given the go-ahead. Corman was surprised because his experience with the major studios was not always positive. Corman added: "It went that fast. Right place at the right time. The title was changed to "The Secret Invasion", which was believed to be more commercial. UA budgeted the production at $600,000, which was double my bigger Poe [Edgar Allan Poe] pictures. The film was shot in the summer of 1963."
Due to an earthquake in Yugoslavia during filming, the production didn't get all of the Yugoslav soldiers they were promised could be used as extras, along with accompanying military equipment, because everything was needed for rescue and recovery work.
Yugoslav government officials demanded that Yugoslav Resistance ("Partisan") characters wear red stars on their uniforms. Director Roger Corman tried to stop this, arguing that partisans would not identify themselves to the Nazis in this way, but the Yugoslavs had their own way. However, Corman found a solution to this visual problem--he had them edited out in post-production.
Director Roger Corman said of the changes to the original script, "Initially, the prisoner being held was an atomic scientist, the only man knowing the missing key ingredient in the equations to make an atomic bomb. So by freeing him, the five criminals help unleash atomic warfare. And UA [United Artists] said they liked the idea but not that man. So I changed him to an Italian general who would lead the resistance against the Nazis and thereby facilitate an Allied invasion of Italy. UA wanted them to be full-out heroes with less subtlety than I might have sought. I had wanted them to unwittingly and ironically do something bad on their way to being heroes. But this was the majors, and with a half-million of their dollars at stake, I had a feeling these characters might lack nuance. I knew this was one of the drawbacks to working with the studios--story by committee."