He had left his native Pakistan for the United States at age 8 to see his dying mother. By 18, he was the star of his high school basketball team in Queens, so Americanized that as he waited with thousands of men to be fingerprinted and questioned at federal immigration headquarters, he had just one worry: missing basketball practice.

“Why am I here?” the teenager, Mohammad Sarfaraz Hussain, asked his lawyer on that day in February 2003.

By nightfall he had been tagged for deportation because he lacked proper papers, along with more than 13,000 of about 83,000 people who complied with “special registration,” a program created in the jittery aftermath of the Sept. 11 attacks for noncitizen males older than 15 from predominantly Muslim countries.

For Mr. Hussain, it was the start of a legal struggle that lasted long after the government abandoned the program amid charges that special registration amounted to racial profiling and was an ineffective tool against terrorists.