DENVER -- The former graduate student accused in the deadly Colorado movie theater shooting was being treated by a psychiatrist at the university where he studied, according to court papers filed Friday.

Defense attorneys for James Holmes, 24, made the disclosure in a court motion. It sought to discover the source of leaks to some media outlets that Holmes sent the psychiatrist a package containing a notebook with descriptions of an attack.

The motion said the leak violated a judge's gag order and jeopardized Holmes' right to a fair trial.

"The government's disclosure of this confidential and privileged information has placed Mr. Holmes' constitutional rights to due process and a fair trial by an impartial jury in serious jeopardy," wrote the attorneys.

The motion added that the package contained communications between Holmes and his psychiatrist that should be shielded from public view. The document describes Holmes as a "psychiatric patient" of Dr. Lynne Fenton.

PHOTOS: A Community In Mourning
Story continues below.

Loading Slideshow...
  • Family members of the victims of Friday's mass shooting in Aurora, Colo., comfort each other, Sunday, July 22, 2012, in Aurora, Colo., during a prayer vigil for the victims. Twelve people were killed and dozens were injured in a shooting attack Friday at the packed theater during a showing of the Batman movie, "The Dark Knight Rises." Police have identified the suspected shooter as James Holmes, 24. (AP Photo/Ted S. Warren)

  • Family members of the victims of Friday's mass shooting in Aurora, Colo., comfort each other, Sunday, July 22, 2012, in Aurora, Colo., during a prayer vigil for the victims. Twelve people were killed and dozens were injured in a shooting attack Friday at the packed theater during a showing of the Batman movie, "The Dark Knight Rises." Police have identified the suspected shooter as James Holmes, 24. (AP Photo/Ted S. Warren)

  • A woman carries a wreath, Sunday, July 22, 2012, in Aurora, Colo., during a prayer vigil for the victims of Friday's mass shooting at a movie theater. Twelve people were killed and dozens were injured in a shooting attack Friday at the packed theater during a showing of the Batman movie, "The Dark Knight Rises." Police have identified the suspected shooter as James Holmes, 24. (AP Photo/Ted S. Warren)

  • A group of friends with various connections to the deceased and wounded gather at a prayer vigil outside the Aurora Municipal Center in Aurora, Colo., Sunday July 22, 2012. The vigil was held to remember the dead and injured in the shooting rampage Friday at movie theater in in Aurora. (AP Photo/Barry Gutierrez)

  • In this overview, the Living Hope Baptist Church choir sing to start the a vigil for the victims of Friday's mass shooting at a movie theater, Sunday, July 22, 2012, at the Aurora Municipal Center campus in Aurora, Colo. Twelve people were killed and dozens were injured in a shooting attack early Friday at the packed theater during a showing of the Batman movie, "The Dark Knight Rises." Police have identified the suspected shooter as James Holmes, 24. (AP Photo/The Denver Post, Joe Amon, Pool)

  • Aurora Police officer John Bulman keeps an eye on the crowd during a prayer vigil, Sunday, July 22, 2012, in Aurora, Colo., for the victims of Friday's mass shooting at a movie theater. (AP Photo/Ted S. Warren)

  • The sun breaks through clouds, Sunday, July 22, 2012, in Aurora, Colo., during a prayer vigil for the victims of Friday's mass shooting at a movie theater. (AP Photo/Ted S. Warren)

  • A woman carries a balloon that says "Missed by many, forgotten by none," as she walks to a memorial display, Sunday, July 22, 2012, in Aurora, Colo., during a prayer vigil for the victims of Friday's mass shooting at a movie theater. Twelve people were killed and dozens were injured in a shooting attack early Friday at the packed theater during a showing of the Batman movie, "The Dark Knight Rises." Police have identified the suspected shooter as James Holmes, 24. (AP Photo/Ted S. Warren)

  • U.S. Navy officers salute Sunday, July 22, 2012, in Aurora, Colo., after they left items at a memorial display at a prayer vigil for the victims of Friday's mass shooting at a movie theater. (AP Photo/Ted S. Warren)

  • A man holds his head in front of a memorial after a pray vigil Sunday, July 22, 2012 in Aurora, Colo. Twelve people were killed and dozens were injured in a shooting attack early Friday at the packed theater during a showing of the Batman movie, "The Dark Knight Rises." Police have identified the suspected shooter as James Holmes, 24. (AP Photo/Alex Brandon)

  • People hold signs of hope that feature the Batman logo as they attend a prayer vigil Sunday, July 22, 2012, in Aurora, Colo., for victims Friday's mass shooting at a movie theater showing the latest Batman movie. (AP Photo/Ted S. Warren)

  • A man at a prayer vigil for victims of Friday's mass shooting at a movie theater in Aurora, Colo. pauses after placing items at a memorial display, Sunday, July 22, 2012. (AP Photo/Ted S. Warren)

  • Audience members pray, Sunday, July 22, 2012, in Aurora, Colo., at a prayer vigil for the victims of Friday's mass shooting at a movie theater. (AP Photo/Ted S. Warren)

  • Anne Marie Hochhalter, 30, bottom, and her friend Roxy Chesser, 30, second from right, attend a prayer vigil, held to remember the lost and injured in Friday's mass shooting at a movie theater, in a park outside the Aurora Municipal Center in Aurora, Colo., Sunday July 22, 2012. Hochhalter, a paralyzed victim of the Columbine High School tragedy over 12 years ago, and other survivors of the 1999 massacre reached out to people who survived the theater shooting. Twelve people were killed and dozens were injured in a shooting attack during a showing of the Batman movie, "The Dark Knight Rises." Police have identified the suspected shooter as James Holmes. (AP Photo/Barry Gutierrez)

  • Aurora shooting

    Balloons released by family members of the victims of Friday's shooting are reflected in the windows of Aurora City Hall, Sunday, July 22, 2012, in Aurora, Colo., at a prayer vigil for the victims of Friday's mass shooting at a movie theater. 12 people were killed and 58 were injured in a shooting during an early Friday premiere of

  • Aurora shooting

    Family members remember their loved ones Sunday, July 22, 2012, in Aurora, Colo., at a prayer vigil for the victims of Friday's mass shooting at a movie theater. 12 people were killed and 58 were injured in a shooting during an early Friday premiere of

  • Aurora shooting

    Family members remember their loved ones Sunday, July 22, 2012, in Aurora, Colo., at a prayer vigil for the victims of Friday's mass shooting at a movie theater. 12 people were killed and 58 were injured in a shooting during an early Friday premiere of

  • Aurora shooting, John Hickenlooper

    Gov. John Hickenlooper, center, bows his head Sunday, July 22, 2012, in Aurora, Colo., at a prayer vigil for the victims of Friday's mass shooting at a movie theater. 12 people were killed and 58 were injured in a shooting during an early Friday premiere of

  • Aurora shooting

    Cub Scouts carry flowers to a memorial display Sunday, July 22, 2012, in Aurora, Colo., at a prayer vigil for the victims of Friday's mass shooting at a movie theater. 12 people were killed and 58 were injured in a shooting during an early Friday premiere of

  • Aurora shooting

    The crowd listens to speakers Sunday, July 22, 2012, in Aurora, Colo., at a prayer vigil for the victims of Friday's mass shooting at a movie theater. 12 people were killed and 58 were injured in a shooting during an early Friday premiere of

  • Stacy Moriarty, center left, raises her hand as she she joins thousand in a unified cheer as Gov. John Hickenlooper speaks during a vigil, Sunday, July 22, 2012, at the Aurora Municipal Center in Aurora, Colo., for the victims of Friday's mass shooting a movie theater. Twelve people were killed and dozens were injured in a shooting attack early Friday at the packed theater during a showing of the Batman movie, "The Dark Knight Rises." Police have identified the suspected shooter as James Holmes, 24. (AP Photo/Barry Gutierrez)

Calls to Holmes' lawyer, Daniel King, were referred to the head of the Colorado State Public Defender's office, Douglas Wilson, who was out of the office and did not immediately return a message seeking comment.

A message left with Fenton's office was not immediately returned. The University of Colorado's website identifies her as the medical director of the school's Student Mental Health Services.

Casmir Spencer, a spokeswoman for the Arapahoe County District Attorney's office, said she could not comment.

The package was seized by authorities on Monday after it was discovered in the mailroom at the University of Colorado, Denver. It's unclear if it was sent before the attack at the July 20 midnight showing of "The Dark Knight Rises" that left 12 dead and dozens of others injured.

Authorities said Holmes legally purchased four guns before the attack at Denver-area sporting goods stores - a semiautomatic rifle, a shotgun and two pistols. To buy the guns, Holmes had to pass background checks that can take as little as 20 minutes in Colorado.

State law bars from purchasing firearms people who have been found mentally defective by a judge or have been committed to a mental institution. The statute makes no restrictions on buyers who are being treated for possible mental illness.

Holmes spent a year as a graduate student in the university's intimate, competitive neuroscience program before dropping out without explanation three days after taking a year-end final, university officials have said.

They have refused to disclose more about Holmes, citing the judge's gag order on law enforcement agencies.

At a press conference earlier this week, they acknowledged that students in the program that Holmes studied in are carefully monitored. They said a graduate student experiencing problems would normally be referred to student support services.

Earlier on HuffPost: