As part of an officer exchange program, Benzite Ensign Mendon is brought aboard the Federation starship Enterprise. Acting Ensign Wesley Crusher mistakes Mendon for Mordock, another Benzite who took the Starfleet entrance examination with him (cf. "Coming of Age"). Captain Picard suggests a similar officer exchange with the Klingons, and Commander Riker readily volunteers. Riker is assigned to the Klingon ship IKS Pagh, captained by Kargan. Before Riker departs for the Pagh, Lt. Worf, who has taught Riker some of Klingon tradition, gives Riker a transponder for him to use in the event of an emergency. Riker embraces his role as the Klingon First Officer, and when challenged by Second Officer Klag, he subdues Klag by force, which pleases Captain Kargan.
Before the ships move away, Mendon scans the Klingon vessel and discovers a patch of strange organic material on its hull but does not bring it to Captain Picard's attention. Worf soon discovers a similar patch on the Enterprise hull, identifying it as a lifeform. Mendon reveals that he identified the same matter on the Klingon ship. When asked why he didn't mention this before, he explains that on Benzite ships, it is considered improper to bring up a problem before you have a solution. Picard chastises him for withholding the information and orders the Enterprise to intercept the Pagh, as the organism will be more damaging to the older ship. Mendon discovers the means to remove the organism from both ships while en route.
The Klingon crew of the Pagh discovers the organism eating away at the hull. Kargan concludes that it must be a new Federation weapon, noting that the Enterprise had heavily scanned the area during their rendezvous. The Pagh cloaks and prepares to attack the Enterprise. In a heated argument, Riker is unable to convince Kargan to stand down even after the Enterprise sends a message with how to remove the organism. Suspicious of the radio silence, the Enterprise raises its shields. Seemingly accepting his fate, Riker convinces Kargan to close to a distance of 40,000 kilometers before attacking the Enterprise. He activates the transponder he got from Worf and tricks Kargan into taking it. The Enterprise locks onto the transponder signal and waits for the Pagh to get within transporter range, which is 40,000 kilometers. Kargan is beamed to the Enterprise's bridge and draws his phaser but is quickly stunned by a phaser blast from Worf. Under Riker's command, the Pagh decloaks and demands that the Enterprise surrender, which Picard agrees to, serving to disgrace Kargan further. The Enterprise cleans the organism from the Klingon ship, and Kargan is returned. Riker allows Kargan to hit him and order him off the ship to allow the Klingon to regain some of his dignity before the Pagh departs.
Brian Thompson was cast as the Klingon Lieutenant Klag. He had some difficulties during the audition process as the producers originally sought to have the actor portraying that part wear the same costume created for Christopher Lloyd in Star Trek III: The Search for Spock. His audition was originally cancelled, as he later explained, "I phoned Herb Tobias, who was the head of the agency at the time, and told him what happened. I said, 'Herb, would you mind calling the Star Trek office and figuring out a tactful way of asking them, Who casts this program? The directors and producers or the wardrobe department?'". Thompson praised the work of Jonathan Frakes, saying he is a "true professional and I loved working with him."