The device was found shortly before classes were to begin at Alice Birney Elementary School at 6351 13th Street. The school's plant manager found the device on a table in the cafeteria, but it was not immediately known how it got there, Sgt. Andrew Pettit said.
The department's bomb squad was called, and officers determined it was safe to transport, but it was not known if explosives were still inside the pipe, Pettit said.
"It appeared that someone had attempted to detonate it," Pettit said.
The device was transported to a secure location and it was exploded, police said.
There were no signs that the school was broken into, and someone may have brought the device inside, Pettit said. School officials are interviewing students and employees.
Once the device was discovered, children were evacuated to an opposite area of campus until the device was taken away, Pettit said.