HOUSTON  Every good referee strives for accuracy and credibility and, on his best nights, for virtual anonymity on the basketball court.

“Better not to be seen,” said Scott Foster, an N.B.A. referee for 14 seasons. “If you were not seen that night, you did one of two things: You either did a really great job, or you didn’t get involved at all.”

By consistently getting it right, Foster became one of the most respected young referees  only to have his credibility impugned and his anonymity stripped by an unfortunate friendship and a provocative news report.

Foster, 41, was once a close friend of Tim Donaghy, the disgraced former referee who is now serving a 15-month sentence for conspiring with gamblers. Their friendship ended more than a year ago, when Donaghy was caught. But the black cloud Donaghy created nearly engulfed his old friend in July, when a news report heavily implied that Foster was involved in the gambling scheme.