Nikolas Cruz, the 19-year-old accused of going on a shooting rampage at Marjory Stoneman Douglas High School on Valentine's Day, took an Uber to the school, according to court records released Thursday.

>> Read more trending news

The Associated Press reported Uber confirmed that Cruz used the service before the shooting. The company would not answer questions about if the Uber driver noticed strange behavior from Cruz, or whether he was carrying a gun.

The company said it is helping law enforcement with the investigation.

According to the document charging Cruz with 17 counts of premeditated murder, a witness saw Cruz and recognized that he was a troubled student. He was wearing black pants, a black hat and a burgundy shirt. He carried a duffle bag and wore a black backpack.

The minute the witness heard gunshots, a "code red" was called, the report said.

Cruz told police he was that gunman.

Related: Who is Nikolas Cruz, accused gunman in Florida high school attack?

As students fled, Cruz said, he thought up a plan to discard the AR-15 rifle and the extra magazines he had in his backpack so he could slip out with the other students. Police found the items where Cruz said they would be.

Cruz remained in jail Thursday. A judge denied bond for the former high school student. He has been placed on a suicide watch.