When Thomas Wong set foot in the United States Embassy in Beijing this summer for a new diplomatic posting, it was vindication after years of battling the State Department over a perceived intelligence threat — himself.

Diplomatic Security officers had informed him when he joined the foreign service more than a decade ago that they were banning him from working in China. In a letter, he said, they wrongly cited the vague potential for undue “foreign preference” and suggested he could be vulnerable to “foreign influence.”

Mr. Wong had become a U.S. diplomat thinking that China was where he could have the greatest impact. He had grown up in a Chinese-speaking household and studied in the country. And as a graduate of West Point who had done an Army tour in the Balkans, he thought he had experience that could prove valuable in navigating relations with the United States’ greatest military and economic rival.

As he looked into the ban, he discovered that other diplomats — including many Asian American ones — faced similar restrictions. Security officers never gave the exact reasons, and they made the decisions in secret based on information gathered during the initial security clearance process. Thousands of diplomats have been affected by restrictions over the years.

Similar issues range across U.S. government agencies involved in foreign policy and national security. In the growing espionage shadow war between the United States and China, some American federal employees with ties to Asia, even distant ones, say they are being unfairly scrutinized by U.S. counterintelligence and security officers and blocked from jobs in which they could help bolster American interests.

The paranoia weakens the United States, they say, by preventing qualified employees from serving in diplomatic missions, intelligence units and other critical posts where their fluent language skills or cultural background would be useful.

This story is based on interviews with more than two dozen current and former officials from multiple national security agencies and a review of dozens of Defense Department documents on security clearance cases.

The concerns, most loudly voiced by Asian American diplomats, are urgent enough that U.S. lawmakers passed bipartisan legislation in December to try constraining some practices at the State Department. The military spending bill of Dec. 14 includes language pushed by Representative Ted Lieu, Democrat of California, intended to make the department more transparent in its assignment restriction and review processes.

“We should be asking ourselves how to deal with the risk, not cutting off the people who have the best skills from serving altogether,” Mr. Wong said. “That’s a self-inflicted wound.”

The State Department eventually reversed the ban on Mr. Wong after he and others raised the issue internally. Similarly, the State Department has lifted 1,400 assignment restrictions during the Biden administration, and Secretary of State Antony J. Blinken this year announced an end to the practice.

But there are still bars for officials to clear. Today, some 625 State Department employees remain under the ban, according to department data released to The New York Times. The agency did not explain why. In addition, counterintelligence officers can recommend bans after investigating employees with job offers to countries, most prominently China, judged to pose special intelligence threats.

At the F.B.I., two counterintelligence officers said separately that they were persecuted by colleagues because of their China background, according to interviews and documents examined by The Times and reported here for the first time.

Similar fears of Chinese espionage in American institutions led to the creation of the Justice Department’s China Initiative during the Trump administration, when the F.B.I. investigated many ethnic Chinese scientists inside and outside the U.S. government whom federal agents suspected of illegally aiding China. In some cases where the Justice Department was unable to find evidence of espionage, officials brought lesser charges, only to drop them — but not before damage was done to the scientists’ reputations and careers. The department shut down the China Initiative in 2022.

The processes inside the national security agencies have existed since before the China Initiative and occur in the secretive world of vetting for security clearances and assignments. Because these inquiries are not public criminal investigations, they have gotten less public attention.

Critics of the bans say an American with family members in China is no more susceptible to becoming a Chinese intelligence asset than anyone else. And they say the U.S. government has failed to catch up to a population that has undergone vast demographic shifts in recent decades. One in four children in America has at least one immigrant parent, compared with 13 percent about 20 years ago. China remains a top country of origin for newly naturalized American citizens.

Government employees have little control over those family circumstances. Some U.S. officials argue, however, that security clearance denials or job restrictions are still justified because of the Chinese government’s record of putting pressure on some foreign citizens by detaining or harassing family members in China.

Legislation in 2021 cited State Department data showing the agency had placed the most restrictions for posts in China, followed by Russia, Taiwan and Israel. Some Russian American diplomats also have been affected.

The State Department said in a statement that it does not practice discrimination based on race, ethnicity or national origin, and that Mr. Blinken is determined to build a diverse workforce. It also said its counterintelligence processes are based on guidelines from the Office of the Director of National Intelligence, and 13 criteria outlined in the Foreign Affairs Manual.

Senior Asian American officials do work throughout U.S. agencies, including on Asia policy. Vice President Kamala Harris’s mother is from India, and Katherine Tai, whose parents are from Taiwan, is the U.S. trade representative, a cabinet post.

But Representative Andy Kim, Democrat of New Jersey and a former State Department diplomat, said Asian American employees from across the government have approached him with concerns about the “constant specter hanging over them.”

Mr. Kim, who is Korean American, got a State Department letter a dozen years ago saying he was barred from working on issues involving the Korean Peninsula.

“It was one of the most disrespectful, humiliating experiences of my career,” he said.

Many federal government agencies have their own internal security unit that conducts investigations into employees, often without notifying the employee or giving any insight into their process. In the F.B.I., the unit conducts polygraph tests and can recommend that the department withhold or revoke an employee’s security clearance.

At the State Department, security officers would use information gleaned during regular background checks for security clearance to determine whether or not to take the extraordinary step of putting an assignment restriction into the file of a diplomat.

For many U.S. officials, obtaining the initial top-secret security clearance is an intrusive process, but is needed for their jobs. Applicants list their ties in foreign countries and subject themselves to a microscopic review of their personal relationships, former employers, financial history and lifestyle. Security officers can deny or revoke a clearance for reasons like holding large debt or recent illegal drug use.

The bar that certain federal employees and contractors have to clear appears to have risen as concerns have grown about China’s espionage capabilities. Public documents posted online by the Defense Department show how in the vetting of security clearances for individual federal contractors, the assessments of China’s spying efforts over the past two decades have grown longer and more detailed, according to a review by The Times of more than three dozen of the documents.

Applicants with ties to China face a “very heavy burden” of persuasion that they are not potential intelligence threats, the decisions often say.

In one 2020 decision, a 24-year-old engineer for a defense contractor who immigrated to the United States from China in middle school was described by an administrative judge as a “loyal American citizen” who lived a “typically American lifestyle.” But his ties to family members in China, while “perfectly normal,” also posed a “heightened risk of manipulation or inducement,” the judge wrote. His appeal for clearance was denied.

In another case from 2022, a man who was born in the United States and worked for a defense contractor was denied a clearance because of his wife’s Chinese relatives. The judge acknowledged that “coercion is rare,” but added that “it does occur, and there is little that China would not do to further its goals.”

Mark Zaid, a lawyer who has represented hundreds of government employees fighting agencies on security clearance decisions, said “there’s no doubt that Asians bear the brunt of that scrutiny more so than many others.”

Susan Gough, a Defense Department spokeswoman, said that security clearance determination is a “risk-based decision,” and that the department aims to verify each employee “is worthy of the special trust granted to them on behalf of our nation.”

Several public cases have revealed counterintelligence overreach within federal departments. In November 2022, Sherry Chen, a China-born American hydrologist who worked on flood forecasting, won a $1.8 million settlement from the Commerce Department after officials there accused her of unlawfully downloading sensitive government data and falsely portrayed her as a spy for China. They based their suspicions on a brief exchange she had with a former classmate who was also a local Chinese official. The F.B.I. arrested her, but prosecutors eventually dropped charges.

“They have a mindset that you are a spy, and all they want to do is prove their theory,” Ms. Chen said in an interview.

In 2021, a Senate committee released a report about the Commerce Department’s security unit that revealed Ms. Chen was one of many Chinese American employees who had been unlawfully investigated.

The report concluded that the unit had functioned as a “rogue, unaccountable police force,” and that it had broadly targeted offices with “comparably high proportions of Asian American employees.”

Even government officers who work on China counterintelligence are sometimes perceived as potential threats by security officials. They say those parts of their background that give them a familiarity with China unfairly mark them in the eyes of officials as possible spies.

Chris Wang became a counterintelligence analyst in the F.B.I.’s Los Angeles field office after graduating from the University of California at Davis. Although he got a top-secret security clearance, he was handed a letter on his first day in 2011 stating he was being placed in a special internal surveillance program known as PARM, in which his contacts, travels and computer use would be scrutinized by security officials. He would also be subject to frequent polygraph tests and interviews, according to a copy of the letter Mr. Wang shared with The Times.

“Your foreign contacts and foreign travel create a heightened risk of foreign exploitation,” it said.

Mr. Wang had trained under Chinese martial arts teachers in California and had done a half-year of undergraduate study in Shanghai.

His supervisors assigned him to counterintelligence on China. Then he lost access to the most sensitive information after failing a polygraph test; he said he was nervous because he feared being wrongly accused of having nefarious China ties.

While he passed a subsequent polygraph test and security interview to become an agent, Mr. Wang quit in 2020, after officials told him they would do an administrative inquiry into him, he said.

“Because of the stigma around China, Chinese Americans are more likely to be put in a box even if their associations are innocent in nature,” Mr. Wang said.

Another former F.B.I. officer who worked in counterintelligence, Jason Lee, said he was suing the agency for discrimination and for using national security as a cover for abusive behavior. At one point, he said, a polygraph test interrogator noted that Mr. Lee’s father also worked in a sensitive government job and wrongly accused him of being part of a “father-son Chinese spy ring.” Mr. Lee said that infuriated him and caused him to fail the test.

The F.B.I. declined to comment on specific cases but said it conducts polygraph tests fairly. It also said that “diversity is a core value” and that it fosters an environment where employees “are respected, are encouraged to be who they are, and are afforded every opportunity to thrive.”

At the State Department, a group representing Asian American employees has worked to push the agency to overhaul assignment restrictions. That has led to laws since 2016 aimed at forcing changes.

“I know dozens of diplomats who have lost out on getting assignments to China, Hong Kong and Vietnam,” said Yuki Kondo-Shah, a diplomat in London who successfully fought an assignment restriction banning her from Japan.

Although the employees praise Mr. Blinken’s statement in March announcing a softening of restrictions, they worry about another limit still in place: the provision called assignment review, in which counterintelligence officers can recommend bans after a routine investigation of employees with offers for posts that department officials assert have special intelligence threats.

“It’s really problematic,” said Tina Wong, a vice president of the U.S. Foreign Service union.

The list of posts is classified, but The Times learned that in addition to China, it includes Russia, Vietnam and Israel, which is a U.S. partner.

Stallion Yang, a diplomat whom the State Department once banned from working in Taiwan, has gathered data for the Asian American Foreign Affairs Association, an employee group, about officials up for postings to one of the special intelligence-threat countries. Since 2021, he said, he has tracked 22 cases of employees with ties to Asia who were under investigation for longer than the standard period of one month.

The association sent a letter to Mr. Blinken raising concerns. Last month, John Bass, the under secretary of state for management, replied in a letter obtained by The Times that of 391 assignment-review investigations in the last year, only nine had resulted in a recommendation of rejection.

But diplomats say the number does not take into account employees who moved on to other jobs after the investigations dragged on.

And beyond those concerns, there are aspiring diplomats who were cut out of jobs much earlier, even failing to get security clearance approval.

One China-born American, Ruiqi Zheng, 25, said the State Department told her she would be denied a security clearance even though she had begun a selective fellowship there. After a clearance process lasting almost two years, she was rejected in 2021 because of ties to family members and others abroad, she said.

“Everyone I knew told me that it was too good to be true, that America would never accept foreign-born Chinese Americans like me,” she said. “But I chose to trust the process.”