The Army cannot single out a captain who is Sikh for special testing to decide whether his hair, turban and beard interfere with the fit and functioning of his helmet and gas mask, a federal judge has ruled.

The Sikh faith requires men to wear their hair uncut and to grow beards, and Capt. Simratpal Singh, a West Point graduate who was decorated for his service in Afghanistan, had asked the Army to waive its usual rules requiring short hair and shaven faces. The Army said it would not decide until after he underwent three days of specialized testing to determine whether his helmet and mask would work properly.

Captain Singh, 28, filed suit on Monday, arguing that singling him out for such testing was religious discrimination, and in a ruling released late Thursday, Judge Beryl A. Howell for the District of Columbia agreed, and issued a restraining order to halt the testing.

Judge Howell’s ruling dealt with the specialized testing and did not directly address whether the Army should waive its grooming rules for Captain Singh. The Army has given him an interim accommodation through March 31, pending its decision, but argued that it could not make a decision without the testing, which it estimated would cost almost $33,000.