 " Bop Gun " was originally meant to serve as the second season finale , but NBC decided to make it the season premiere with the hopes of getting increased ratings from a guest appearance by Robin Williams . Williams portrayed Robert Ellison , the husband of a slain woman tourist . Several news sources indicated Williams took on the role as a favor to Homicide executive producer Barry Levinson , who directed Williams in the films Good Morning , Vietnam ( 1987 ) and Toys ( 1992 ) . But Fontana said Williams agreed to take the part based on the actor 's positive impression of both the show in general and the " Bop Gun " script in particular . Fontana said of Williams , " He read the script , responded instantly and said , ' When do you want me there ? ' . He could not have been more prepared or more of a gentleman to everyone , and he worked his tail off . That whole experience was a joy . " Williams himself said of the show , " Visually , it was just so different from anything else on television . " Although Williams was primarily known for his comedic work , the Homicide producers and Williams himself consciously decided to remain true to the original script , rejecting the idea of adding humor or jokes to the episode . Williams ' scenes were filmed over three days , and the actors found the part emotionally draining . Fontana said , " [ Williams ] worked like a dog . It was quite a special event for all of us . It 's very intense . " 
