A few verses into the performance and Lieutenant CommanderTuvok starts exhibiting irrational behavior: first weeping and then laughing uncontrollably at the opera. EnsignTom Paris immediately goes to his aid, but the Vulcan stands up and, using his full strength, throws Paris across the room. Janeway hails for a security team while crewmembers try to restrain Tuvok. Their efforts fail as he throws them away from him and swipes a phaser pistol away in the process.

Then The Doctor, in a voice of calm control, informs everyone of the problem, Tuvok has gone into pon farr. He then begins singing the aria again, but this time, he changes the words into instructions for Paris to load a hypospray with an anesthetic to subdue Tuvok. Paris prepares the anesthetic and tosses it to The Doctor. He injects Tuvok in the posterior and Tuvok is immediately rendered unconscious. The audience enthusiastically gives The Doctor a standing ovation. He accepts it appreciatively, with a huge smile on his face, as flowers begin to fall on him.

The Doctor awakes to hear LieutenantB'Elanna Torres impatiently calling him. He realizes that he is still in sickbay, as she observes his expression of extreme satisfaction with some curiosity. Embarrassed, he tells her he was "letting his mind wander." This earns him an even more curious look as holograms do not daydream. The Doctor is not forthcoming with any details and Torres does not press the issue.

Torres hands The Doctor a PADD detailing the members of an away team she is about to lead on a planetary survey, as well as sensor scans of the planet. The Doctor is very displeased to see that he is not on the list of away team members, though he was initially supposed to be. There is a canyon on the planet he wanted to get holo-images of. Torres explains that his presence on the team is no longer considered necessary and offers to take the images for him. He refuses to let her take his images so she leaves sickbay. Once she is gone, The Doctor returns to his daydreaming.

CommanderChakotay arrives on the bridge with a PADD in his hand. Chakotay is surprised to see a large nebula on the viewscreen. CaptainKathryn Janeway tells him sensors did not detect it until a few minutes ago. He takes his first officer's seat, next to the captain's command chair and hands her the PADD. The PADD contains a formal letter from The Doctor, complaining about his treatment by the crew and outlines a proposal for his advancement. Janeway reads his complaints: failure of the crew to acknowledge his sentience and rudeness towards him. Upon reading the latter, she looks at Paris intently.

She is shocked by his proposal for advancement. She says that he has asked to have his program extended so that he can take over the ship in case the crew is incapacitated. Since the letter is official, protocol demands an official response. Tuvok offers to handle it, but Janeway tells him that she doesn't like anyone on the ship feeling unhappy and decides to respond herself before heading for her ready room.

Phlox of the Hierarchy

The USS Voyager passes by the nebula but hidden within it, observing Voyager, is a small ship. One of the aliens, Phlox, is conducting scans of Voyager when another, presumably his superior, notices his actions and angrily reminds him that the ship was designated as an 'unacceptable risk', meaning attacking her has been deemed to be too risky. He reminds Phlox that the ship is in none of their databases and they have been unable to scan her interior. Due to these facts they have no idea if they can engage and defeat the ship and the Hierarchy never acts on a potential target without first getting this information.

Phlox believes that if he can tap into a data transfer conduit, he could reach the ship's main computer core. Here, he could find all the information they need about the ship. His superior refuses, but Phlox goes over his head by appealing directly to the Hierarchy government. He is instructed to proceed, much to his superior's chagrin.

In Voyager's briefing room, the senior staff is gathered to discuss the upcoming away mission. The Doctor is seated between Paris and Torres, Seven of Nine is seated across the table from him.

The two women are reporting results of scans they have been conducting; first Torres, then Seven. But as Seven is speaking, The Doctor feels something moving on his leg under the table. He looks and finds Torres' bare foot stroking his leg. Paris, her boyfriend, starts making a suggestion about a suitable landing site. During his report, The Doctor notices Seven watching him. She smiles at him seductively and looks at him longingly. She sends him a message on his PADD inviting him for dinner.

Captain Janeway joins in, looking at The Doctor as seductively as Seven is. Neelix makes a point about caution due to the amount of ore they will be hauling from the planet and Janeway rises and walks to The Doctor's seat. Seven and Torres see this and their faces flash with jealousy. Torres brings up that perhaps The Doctor should be included on the away team after all, as the mission is "starting to look a little more dangerous than we thought."

At this suggestion, Seven angrily sends him another message: "RESIST!", in red, blinking letters. She tells Torres she requires his help in the astrometrics lab. Torres demands to know why and they start arguing. Then Janeway suddenly starts cry out as if she is in pain. She tells The Doctor that it is an "old Academy injury" that acts up.

The Doctor rubs Janeway's backside

She suggests to The Doctor that he stay on the ship and "take a look at it," as she takes his hand and places it on her lower back, then slides it slowly down onto her bottom, much to Paris' disgust. Torres leaps to her feet and angrily demands she get away from him. With equal anger, Janeway dismisses her. The Doctor looks on with a smug expression on his face.

His daydream is broken however, when Janeway sharply calls his name to return his attention to her. He and she are alone in the briefing room. In an official tone, she tells him she wants to talk about his letter. She motions him to follow her to her ready room. He follows her, embarrassed.

In her ready room, Janeway expresses grave concern about his letter's content, saying that he seems to never be satisfied despite the unprecedented freedom she has given him over the years. The Doctor earnestly responds that everyone has the right to advance himself and he should too. Janeway turns her attention to his proposal to be given the ability to run the ship. The exact proposal is as follows: to have his program extended to include tactical and strategic abilities. He could therefore function as an Emergency Command Hologram, or ECH, if necessary, essentially a "backup captain" in the event that Janeway and the crew are incapacitated.

Janeway finds the idea interesting, but she denies the request on the ground that altering his program to that degree may prove detrimental, depriving the crew of something they do have a critical need for: a chief medical officer. However, she adds as part of her official response that, once they return home, she will recommend to Starfleet that they look into implementing it as part of starship design. The Doctor is disappointed at her decision.

After the meeting while walking along a corridor, The Doctor finds himself outside Cargo Bay 2. He enters and finds Janeway and the crew gathered. They cheer as Janeway proudly introduces him as the ECH. This confuses him but he enjoys it nonetheless, especially as Seven plants a lingering kiss on his cheek.

Aboard the Hierarchy ship, a pleased Phlox informs another crewmember, Devro, that he has found a way to spy on Voyager from within. He has discovered The Doctor's holographic nature and has tapped into his cognitive subroutines. This will allow him to see everything The Doctor sees. He reports this to his superior, telling him that he has already begun to use the tap. The superior instructs him to continue his surveillance. Phlox acknowledges, even more pleased. He is completely unaware that what he is seeing are merely The Doctor's daydreams.

Voyager orbits the planet designated for the away mission. The away team travels to the surface using the Delta Flyer. The Doctor is on the bridge with Janeway and the other senior bridge officers, as well as Seven of Nine, monitoring the life signs of the away team.

Paris is giving a report over the comm when he calls mayday and reports that the shuttle is being attacked. Tuvok, at the tactical console, scans and, to everyone's alarm, reports that a Borg sphere is the attacking vessel and is approaching fast. Janeway orders red alert and battle stations. She then orders the Borg vessel put on-screen.

An imagined Chakotay transforms into a Borg drone

Tuvok is doing so when Borg implants begin forming on his skin. Seven does a scan and tensely reports that an assimilationvirus has breached the ship's biofilters. Chakotay doubles over in pain, implants spreading on the back of his neck. Janeway orders hard to starboard and deflector shields reinforced, but an explosion from the sphere's attack renders her unconscious. Meanwhile, the rest of the bridge crew is transforming into Borg drones. Seven looks at them, terrified. Ensign Harry Kim, in agony, calls desperately for The Doctor to save them.

The Doctor's face is full of determination. He orders the computer to "activate the Emergency Command Hologram." The sciences division colors of green-blue on his uniform become the command division color of red. Four pips appear on his collar as Seven of Nine watches him adoringly. The computer reports that all systems have been put under his control; he has the bridge. He strides forward, glaring at the viewscreen. He orders all weapons fired on the Borg ship.

On the Hierarchy ship, Phlox watches in amazement.

An imagined Seven adores and desires The Doctor

The Borg hailVoyager with their threat of assimilation. The Doctor, in a stern voice, warns them to back off. Tuvok, now assimilated, lunges toward him. Chakotay, in the same state, advances on Seven. The Doctor grabs two hyposprays, incapacitates Chakotay with one and uses the other to eliminate the new drone. He then incapacitates Tuvok with a Vulcan nerve pinch. Seven looks even more adoringly at The Doctor.

He again warns the Borg to stand down. When they refuse, he orders the activation of the (imaginary) "photonic cannon". The computer obeys. He orders it fired on the Borg sphere. The computer complies and as Phlox watches from his ship, in utter amazement, the sphere is instantly destroyed. His signal tap then goes down.

Kim calls The Doctor's attention back to monitoring the away team. He looks around, embarrassed and somewhat confused. Kim has asked him about the away team's life sign readings. With his attention completely engrossed in his daydream, he did not hear him. He unsteadily checks the scans and reports that they are normal. Kim informs Paris that they are cleared to proceed. Everyone watches The Doctor with concerned curiosity.

On the Hierarchy vessel, Phlox informs his superior what he just saw. Voyager, he reports, is extremely formidable, having destroyed a Borg sphere with a single shot from an intensely powerful weapon it has: a photonic cannon. The superior is skeptical, as there had been and continue to be, no signs of Borg in the area. Phlox insists that is observations are correct. He recommends a "type 3 stealth assault". The superior consults the Hierarchy, which agrees. He orders preparations be made for the attack, as well as scans for any Borg ships.

The Doctor quickly heads for sickbay, trying to avoid meeting or talking to anyone. Chakotay catches up with him in the corridor. He congratulates The Doctor with a beaming smile, commenting that the Borg will think twice before attacking them again. The Doctor is confused because Chakotay's words and actions do not reflect the puzzled, concerned look he gave him on the bridge.

He queries the computer for Chakotay's location and the computer responds that the commander is in his quarters. The Doctor looks at what seems to be Chakotay, who asks The Doctor what is wrong.

In engineering, Kim, Torres and Seven of Nine listen as The Doctor agitatedly recounts what has been happening. He had, he informs them, input new subroutines into his program that allow him to daydream, an activity he has long wanted to be able to do. But now, the subroutines seem to be malfunctioning: he is daydreaming whether he wants to or not.

An imagined Seven and Torres fight over The Doctor

Seven takes his arm, telling the others she can help him. Torres becomes jealously angry and she takes his other arm. Seven insists that the both of them are going to sickbay. Torres angrily accuses her of coming up with any excuse to be alone with him, at which Seven threatens her with assimilation. The Doctor, unlike in his briefing room fantasy, does not look at all happy.

An alarm sounds but Torres and Seven ignore it, continuing to fight over The Doctor. Kim checks the alarm and is shocked to find that the warp containment field is inexplicably destabilizing and a warp core breach is imminent.

Torres and Seven finally scramble to the warp core console. Engineering staff run about in panic. Torres tries to stabilize the core but fails. Computerized attempts to eject it also fail. The only solution to avert calamity is for someone to enter the core and eject it but no organism could possibly survive inside it.

They call on The Doctor, pleading with him to do it. He is unsure if this is a daydream or not but Kim assures him only he can save the ship. The computer voice alerts that it's The Doctor's "last chance to be a hero."

Kim shows Torres and Seven on a PADD what he believes to be the problem with The Doctor's daydreaming subroutines. He turns to explain it to The Doctor and sees, along with Seven and Torres, The Doctor climbing over the railing around the warp core. They ask what he is doing and are horrified by his answer: he is going to eject the core. They rush to restrain him as he loudly protests that he "has to save the ship."

The Doctor is back in sickbay but he is completely locked into his daydreams, unable to stop. As he walks around in his office, going from one fantasy to another, talking to empty space filled in his mind by people he believes are there, Torres explains his condition to Captain Janeway. Torres informs her that she has downloaded his daydreams to one of the ship's two holodecks, where they can be seen and studied to better get an idea of how to repair him. Kim and Seven are on this holodeck, observing the daydreams. Janeway is reluctant to let this go on as she did promise him that they would be more considerate of his sentience and part of that is respecting his privacy. His daydreams are by rights no one's business but his. Torres responds that this may be the only way to properly find a way to fix him. Then Kim hails from the holodeck, they need to see what is playing out on the holodeck from The Doctor's imagination.

The Doctor paints a naked, imagined Seven of Nine

Janeway and Torres enter the holodeck to find it appearing as a darkened Cargo Bay 2. A holographic Seven of Nine reclines naked on a dais, covered from the waist down by a sheet. A hologram of The Doctor is before her, dressed in a painter's smock and beret, clinically studying her as he paints her. Seven looks at herself dispassionately. Kim stares at the daydream. Janeway takes in the scene, unsure of what to say, finally noting, "he does the hands very well."

The scene then changes to The Doctor again as the ECH, taking command of Voyager and saving the day. Janeway and Kim are particularly amused and impressed with the manner in which the captain's pips appear on his collar. Torres notes that this particular fantasy seems to be The Doctor's favorite because it runs more times than all the others. Kim says this particular fantasy algorithm is the most accessible, providing an angle of attack against the problem.

The scene changes again but Torres is very angered about what happens in this one. A hologram of her sits with one of The Doctor in the mess hall. Almost in tears, the holographic Torres asks him why he is dumping her. He responds that she will get over him, which she tearfully disputes. When he mentions Tom Paris she quickly asserts that Paris is not "half the man you are." The real Torres storms off the holodeck in disgust. Kim, amused, suggests to Janeway that they return to sickbay and try to isolate the ECH algorithm and Janeway agrees.

But as they leave, she sees one more fantasy: The Doctor being congratulated by her for saving the ship. He quietly responds that all he ever wanted was to live up to his full potential and to help the crew that he loves. Janeway is visibly touched by this last scene.

Aboard the Hierarchy ship, Phlox watches his monitor in disbelief and fear. He finally realizes that what he was seeing was not real but fantasies in The Doctor's imagination. Thus, on his recommendation, they are about to attack a vessel they in actuality know nothing about. He tries to salvage the situation by suggesting to his superior that perhaps Voyager may not be worth attacking but his suggestion falls on deaf ears. The superior warns him menacingly that his data had better be accurate. A look of great worry is on Phlox' face.

Torres spends half the night repairing The Doctor and finally is able to turn off his daydreaming algorithms. The next morning, Janeway comes to see him in sickbay. He tells her that he is very embarrassed and apologizes for altering his program without her clearance. She does not rebuke him for doing so. She tells him that daydreaming is a good thing, as it lets one imagine other possibilities in life. But, she adds, he should wait until a way is found to add this ability to his program without damaging it. He readily agrees with her assessment.

Janeway begins to reconsider the Doctor's request to expand his program, and looks up Starfleet's legal precedents for giving command to a hologram; unsurprisingly there are none. Chakotay tells her that the Doctor should focus on his regular medical duties, but Janeway has realized that they may be imposing their own human limitations on him. Although she isn't fully comfortable with the idea of maybe one day handing command over to him, she admits that they may not be allowing the Doctor to live up to his full potential.

Later The Doctor is examining samples in sickbay and sounds and sights he does not want to hear or see begin to fill the room. To his great horror, he finds that he is once again in the daydream of him receiving a commendation from Captain Janeway in front of the cheering crew in Cargo Bay 2. He hails the bridge, reports the relapse of his daydreaming and asks to be shut off.

Phlox warns The Doctor of the impending Hierarchy attack

He then sees someone who is not a crewmember: Phlox. He explains that he is using The Doctor's daydream to project himself to him. He urgently informs him of the impending Hierarchy attack. The Doctor demands his identity and Phlox gives it to him. He begins to explain what the Hierarchy does: they hide and scan passing ships for useful or valuable materials and raids the vessels. It is the job of the long-range observer, of which he is one, to do the scanning. He spotted Voyager and tapped into The Doctor's program to spy on the ship from within through him. Unfortunately, the tampering caused The Doctor's daydreaming subroutines to destabilize and now Phlox, in a very bad situation, as what he thought was reality are really The Doctor's fantasies.

The Doctor becomes angry with Phlox and asks why he is helping Voyager. Phlox responds that, over the time he has spied on them, he has seen how much possibility exists in him to be more than he is now. This seems to be a trait that the entire crew has, he explains. This is a very fascinating and attractive concept to him as his species is in no way like that. He does not want The Doctor or the crew harmed. His sincerity finally wins The Doctor over.

The Doctor rushes onto the bridge and informs Janeway of the impending attack. Chakotay asks how he knows this as Paris, who has returned from the away mission and is back at the conn console, reports no ship detections on sensors. The Doctor responds that an alien appeared to him in a daydream and informed him. This angers Janeway and she demands to know why he disobeyed her orders and altered his program again. He responds that he can prove it and gives Kim a PADD containing sensor modifications that will allow them to detect the Hierarchy ships, which are cloaked; Phlox's, plus two more that will join the attack. Kim inputs the data and, with surprise, informs Janeway that The Doctor is telling them the truth. On her order, Kim puts the ships on the viewscreen.

Janeway wants to remove Voyager from the area at maximum warp. The Doctor however, advises her that will not work because the Hierarchy have ships all over the sector. If they escape these ships, they will run into others. However, Phlox has promised to provide the resonance frequencies of their phasers.

In return for the frequencies, Phlox wants the following: he has told his superior that The Doctor is in command of Voyager and that fiction must be maintained. When the superior opens a comm channel to demand their surrender, as the Hierarchy always does to a victim, The Doctor must be the one sitting in the command chair. Janeway cannot believe what she hears but she agrees to the scenario if it will keep them from being attacked by ships that are obviously more advanced.

In sickbay, Kim helps to reprogram The Doctor to make his ECH fantasy a reality, at least for now. The Doctor, however, is extremely nervous because daydreaming about commanding the ship is very different from actually commanding Voyager. Kim assures him he will do fine. He wanted to have this chance and he now has it.

On the Hierarchy ship however, a severe complication appears in Phlox' plan. Voyager's lack of damage from the imagined Borg encounter causes his superior to change the intended assault pattern to "Type Four" instead of "Type Three". This stipulates continuous re-modulation of their phaser frequencies. The frequencies he was planning on giving Voyager will be useless and he cannot give them any others as they will be changing continuously. He rushes to inform them.

The Doctor returns to the bridge in his ECH uniform. He nervously sits in the captain's seat. Chakotay, in his first officer's seat, assures him, like Kim, that he will do fine. Janeway is in astrometrics with Seven to monitor the situation. Seven has created a comlink that will allow only The Doctor to hear Janeway. This way she can prompt him on what to say and how to act.

The attacking Hierarchy ships arrive

Phlox hails and quickly informs The Doctor of the change in attack plan, the three Hierarchy ships arrive and de-cloak. Phlox' superior hails Voyager as Phlox said would happen. Chakotay orders an on-screen answer. The superior appears and tersely informs Voyager of their intent to raid them. Janeway prompts The Doctor with a response but in his nervousness, he makes a mistake, though he immediately corrects it. As the superior threatens them, Tuvok cuts the communication long enough to inform Chakotay that he has found a potential weakness in the attackers' shields. Chakotay moves to the tactical station to see it and orders the communication reestablished.

The superior orders them to stand down their weapons and prepare to be boarded. Tuvok reconfigures the phasers to take advantage of the weakness he has found and fires. The Doctor overacts and shouts out, "Ha! How do you like that, huh? A taste of your own medicine!" Janeway warns him to calm down as the Hierarchy ship returns fire. The shot takes their weapons offline. The superior orders them again to prepare for boarding. Janeway instructs The Doctor to offer to negotiate.

"I'd rather not give the order to fire..."

Instead The Doctor gets a flash of inspiration. His nervousness vanishes as he commands Tuvok to "activate the photonic cannon." Tuvok has no idea what he speaks of but Chakotay discreetly orders him to act like he does. He 'acknowledges' and pretends to input the command. The Doctor, in a steady voice, warns the superior to withdraw. He states that the superior has seen the weapon's power. Phlox "reminds" him of what he saw it do to the "Borg sphere." The superior hesitates, noting that he detects no weapons powering up, but The Doctor sternly tells him the weapon cannot be detected by sensors. He issues one final warning: withdraw or be destroyed. Phlox agitatedly endorses their withdrawal.

The superior asks the Hierarchy Command for instructions on how to proceed. He is instructed to withdraw. He issues the instruction to his crew and the other ships.

On Voyager's bridge, Kim happily reports the ships are moving off. The Doctor has done it. He cannot believe it and is overjoyed. He reflexively looks to sit down in relief but pauses as he sees he is about to sit in the captain's seat. Chakotay tells him with a smile to go ahead, he has earned it. The Doctor does sit down, with a huge smile on his face.

The Doctor's dream is realized

The Doctor, once again in his science division green-blue and black uniform, is working in sickbay when Seven hails him. She requires his assistance in the mess hall. He acknowledges her request and goes there.

He enters to find the room filled with crewmembers, including the captain, all in dress uniform. They cheer as he looks at them in horror, Kim assures him this is not a daydream. Janeway pins the Starfleet Medal of Commendation on his chest for his "imaginative defense of the ship and crew." He gives her his heartfelt thanks. She also informs him that she has reconsidered his ECH proposal and is going to authorize research into it, there on the ship. He is very happy to hear this and the assembled crew cheers again.

Seven kisses him on the cheek. But she tells him it is only platonic and he is not to expect her to pose for him. He smiles sheepishly but happily, as one of his dreams has finally become reality.

Robert Picardo commented about this episode, "[It] was one of my favourites to shoot [....] It's some of the broadest comedy we did." When interviewed by UK writer Bryan Cairns for an article published in 2016, Picardo referred to this installment as "the last [VOY] episode I remember watching." (SFX, issue 270, p. 65)

In the scene at the beginning of Act Two in which the Doctor imagines himself repulsing a Borg attack, there is a minor continuity error. Tom Paris is initially aboard the Delta Flyer and reports "Voyager, mayday... we've been hit", but is then seen slumped over his station on Voyager's bridge only a couple of minutes later. (This may not be a continuity error, it is a daydream and therefore continuity can go out the airlock)

In a scene when The Doctor is daydreaming and there is an imminent warp core breach in the dream, the computer gives uncharacteristic alerts saying: "Warp core breach a lot sooner than you think!" and "Last chance to be the hero, doctor. Get going!".

The Doctor's daydreams being routed into the holodeck bear resemblance to a similar procedure done to Data in "Phantasms".