Scott Foley is returning to NBC’s comedy “Scrubs.”

Foley, who first appeared on the medical sitcom in its freshman season, is set to reprise his role as a fumbling, insecure patient who developed a crush on his doctor, Elliot Reid (Sarah Chalke).

He is set to guest star in six episodes this fall, beginning with the season premiere.

“Scrubs” is returning for a third season this fall in the 7:30 p.m. Thursday slot.

“Felicity” co-star Foley is preparing for his role in Manhattan Theatre Club’s production of “The Violet Hour” on Broadway this fall.

His wife, “Alias” star Jennifer Garner, filed for divorce in May after a six-week separation. They have been married since 2000.