Last week, Donald Trump made headlines when he detailed his latest immigration proposal: an “ideological test” for immigrants. But while he was right to look to the Cold War for insights on today’s ideological struggle, his focus on the exclusion of communists misses the point. Instead, he would have done better to focus on a more effective pillar of the Cold War: accepting vast numbers of refugees from areas controlled by our enemies.

Communists were first added to the list of “subversives” who are ineligible to enter the United States in 1952. The idea was to prevent the entry of communist spies and head off any potential revolution here. But it was essentially a dud. In the 40 years of the Cold War that followed, an average of just 32 people each year — mostly socialist intellectuals — received the subversive label and were barred. Almost all were in the early 1950s. From 1961 to 1991, just seven subversives were denied entry annually.

Meanwhile, the Immigration and Naturalization Service’s annual reports provide nearly 300 examples of “subversives” who were identified after they entered — Cedric Belfrage, editor of a communist publication called the National Guardian in 1956; Otto Verber, a Soviet espionage agent, in 1960; and Chen Kung Cheng, a suspected intelligence agent for China, in1964, to name just a few.

If the Cold War’s “ideological test” wasn’t terribly effective, why didn’t US anti-communists propose a temporary ban on all immigration from communist-controlled areas (like Trump has done with Muslim countries)? Instead, they accepted 2.6 million refugees, mostly from communist countries.

The broad reason was that the United States saw the benefit of accepting the enemies of our enemies, even if there was a small risk communists could exploit their generosity.

This benefit resulted in part in spreading our ideological message. President Ronald Reagan liked a story about an American sailor on a carrier in the South China Sea who encountered a little boat crammed with refugees. When the refugees saw him on the deck, they shouted, “Hello freedom man!” The President never felt the need to explain that the sailors rescued them. That’s just what Americans do, and that’s why, to those refugees, America meant freedom.

This process is already underway among the Syrian refugees in the United States. Radwan, a Syrian refugee in Ohio, sounded a lot like Reagan’s refugee, explaining: “I came here, to the freedom country.” “I didn’t know anything about Memphis,” Mahmoud Al Hazaz, who escaped Syria to the city, said earlier this year. “The people have been excellent. Their treatment of us has been very good. I’m not just saying this for your sake. When I talk to my family they ask, ‘How is the treatment of Americans,’ and I say ‘it’s wonderful.’ ”

The flip side of spreading our message in the Cold War was combating theirs. President Reagan always kept the Soviet Union’s refugee quota high to demonstrate that the United States was open to those capable of escaping. When he was negotiating with the Soviet Union over nuclear arms, he held up the entire deal to secure emigration rights for refugees. Refugees embarrassed the Soviet Union, demonstrating the superiority of the US system.

Syrian refugees are doing America’s work on this front as well. “I want to keep painting the image to all of my family and friends about the goodness of the American people,” Marwan Batman told the Indy Star. “I wish other refugees would be able to come and experience the same things we have experienced … to find the same happiness we have found here.”

But refugees turned out to be more than mere tools of propaganda. They were also intelligence assets. “Sometimes we were asking them for the names and numbers of friends and colleagues, family members,” wrote Burton Gerber, a former senior American intelligence officer, of the Cold War strategy. “Then we would use the refugee to … [get] a secure message across to the target to come over here and be interviewed and then possibly recruited.”

Many defectors, including KGB agents, soldiers, generals and scientists, joined the American side of the Cold War and directly provided material aid to us. The same is happening in Syria. As former CIA intelligence officer and current Cato Institute analyst Patrick Eddington explained last year, Syrian refugees are “the single best source of information on life inside ISIS-controlled territory.”

The strategy is probably unnerving the Islamic State’s propagandists, who have taken to regularly denouncing refugees as “apostates” and “traitors” to their caliphate in their publications.

Donald Trump is right that we should look to the Cold War for lessons on immigration. But he inflates the importance of excluding communist sympathizers. Far more important to America’s strategy was our emphasis on accepting those who turned against the “Evil Empire.” That is what we have the most to learn from.