SAN FRANCISCO — The former Stanford University swimmer who got six months in jail for sexually assaulting an unconscious woman will be required to attend drug and alcohol counseling on top of random testing after he was caught lying about his high school habits.

Brock Turner, 20, will have the counseling requirements added to his probation before his Sept. 2 release, according to internal probation department communications obtained Tuesday through a public records request.

A judge sentenced Turner in June after he was convicted of sexually assaulting a 23-year-old woman who had passed out outside a campus fraternity house. The six-month sentence led to a national outcry from many who viewed it as too lenient. Turner is expected to serve only half the term because of good behavior.

Santa Clara County Judge Aaron Persky, who is now the target of a recall effort, also had ordered Turner to register as a sex offender for life and submit to random drug and alcohol tests. But Persky didn’t require Turner to undergo counseling, and the probation report did not recommend it.

Turner will go back to court and be ordered to attend counseling sessions, probation manager Jana Taylor said in a June 15 email. She said Turner needs counseling and the department doesn’t “want to be placed in a position in the event we violate him for positive tests and his attorney argues we never modified probation to include counseling.”

Taylor said a judge other than Persky will handle the change in Turner’s probation terms, which is expected to be approved.

Santa Clara County court spokesman Joe Macaluso didn’t respond to an email or phone call seeking information on Turner’s next court date.

Turner denied using illegal drugs in his first interview with a probation officer in May and said he began drinking only after arriving at Stanford in September 2014. But text messages that investigators retrieved from his phone and released after his June 2 sentencing showed otherwise.

He again denied drug and alcohol use in high school during a June 14 jailhouse interview, the probation manager said in her June 15 email. After he was told his texts discussing drug use had been publicized, Turner conceded he was lying. He said he used LSD on three occasions and frequently smoked marijuana and drank alcohol in high school.

The emails also show that Turner asked for protective custody in jail after receiving threats. His attorney, Mike Armstrong, didn’t respond to a phone call and email placed late Tuesday.