Goa'uld attempt to destroy Atlantis

Due to transmissions picked up from members of The Trust, Agent Malcolm Barrett of the NID alerts Stargate Command of a Trust plan to destroy Atlantis on the next scheduled dial-in through a planted bomb. The SGC manages to make contact with the Daedalus which is on route back to Earth by sending an SG-5 to P4M-399 and warns them of the plan so they can relay the message to Atlantis. The Daedalus, pushing its hyperdrive to the limits, manages to get into range of Atlantis and warn them just in time of the threat, stopping the dial-in at the last second. The Daedalus is recalled to help with the investigation while the team looks for the operative who they believe to be human as he's supposed to be a low-level member of the Trust. Due to the suspicious activities of Dr. Peter Kavanagh, he becomes the prime suspect in the case. At the same time, the NID raids a Trust compound and finds computers with some further intelligence on the plan. They don't learn much as the data is cryptic, but they do learn that there's no transmitter on Earth to detonate the bomb, that its something on the Atlantis end that will cause the bomb to detonate. Dr. Meredith Rodney McKay discovers that the city's Zero Point Module failsafes had been disabled and that dialing Earth would have caused the ZPM to overload and explode. In order to reverse this, the command code of the person responsible is needed. The city's systems have also been programed to help this happen, trying to dial Earth which is unsuccessful due to the Stargate's control crystal being removed while at the same time broadcasting a brief distress message with Atlantis' transmitter to draw two nearby Wraith cruisers in order to force the city to be cloaked to give it another opportunity for an overload. When the city cloaks, the program activates the inertial dampeners which, combined with the cloak, cause the ZPM to start to overload. With no other choice and unable to use the Stargate, the Daedalus and the city's Puddle Jumpers take the expedition to the Light Bugs' Planet, the nearest inhabitable planet in the Lantean system. Seeing no other option, Dr. Elizabeth Weir reluctantly agrees to let Ronon Dex torture the information out of Kavanaugh, but he faints before Ronon can start. At the same time, Lt. Laura Cadman discovers two deletions in the city's records with Colonel Steven Caldwell's command code attached. The team quickly stops Ronon's attempt to torture Kavanaugh and have Hermiod beam Caldwell to Atlantis' conference room to be questioned. Upon being confronted by the evidence, Caldwell reveals that he is actually a host to a Goa'uld Trust agent who is the one doing the sabotage. The Goa'uld refuses to give up the command code so Lt. Colonel John Sheppard Tasers him, injuring the Goa'uld and allowing Caldwell to regain control of his body at least temporarily. Caldwell, although in a lot of pain from the Taser and his fight for dominance against his Goa'uld, manages to give Sheppard the code he needs and McKay enters it, shutting down the Trust program and reinitializing the failsafes, averting disaster. Hermiod is later able to use the  Daedalus'  beaming technology to remove the Goa'uld from Caldwell and it is presumably killed afterwards. Caldwell survives the extraction and returns to his position as commander of the Daedalus.