Toy company GoldieBlox had a busy few weeks.

First, the company struck Internet gold with a video promoting its engineering and construction toys for girls, which went viral with more than 8 million views. But the high-profile response came with a price, as the company’s use of a Beastie Boys rap song in the video triggered a legal fight.

The viral video depicts three girls building a Rube Goldberg mechanism with what the toy company described as a parody of the Beastie Boys’ 1986 song “Girls” playing in the background. Instead of the original lyrics (“Girls to do the dishes, Girls to clean up my room, Girls to do the laundry, Girls and in the bathroom, Girls, that’s all I really want is girls”), the GoldieBlox version sang “Girls to build the spaceship, Girls to code the new app, Girls to grow up knowing, That they can engineer that. Girls. That’s all we really need is girls.”

Claiming that the Beastie Boys had threatened the company with copyright infringement over the song, GoldieBlox filed a declaratory judgment action in California federal court seeking to clarify the rights of the parties. “The GoldieBlox Girls Parody Video takes direct aim at the song both visually and with a revised set of lyrics celebrating the many capabilities of girls,” according to the complaint.

“GoldieBlox created its parody video specifically to comment on the Beastie Boys song, and to further the company’s goal to break down gender stereotypes and to encourage young girls to engage in activities that challenge their intellect, particularly in the fields of science, technology, engineering and math,” the complaint continued.

The Beastie Boys responded with praise for the GoldieBlox mission as well as a clarification – the group said it had not threatened legal action. “We strongly support empowering young girls, breaking down gender stereotypes and igniting a passion for technology and engineering,” the group said in a statement. However, the group continued, “As creative as it is, make no mistake, your video is an advertisement that is designed to sell a product, and long ago, we made a conscious decision not to permit our music and/or name to be used in product ads. When we tried to simply ask how and why our song ‘Girls’ had been used in your ad without our permission, YOU sued US.”

GoldieBlox called a truce. The company removed the song from the video and replaced it with different music. GoldieBlox founder Debbie Sterling also penned an open letter to the Beastie Boys on the company’s Web site, writing that she was “ready to stop the lawsuit as long as this means we will no longer be under threat from your legal team.”

The company added that although it “believe[s] our parody video falls under fair use,” it would respect the wishes of the group, including deceased member Adam Yauch, whose will specified that Beastie Boys songs never be used in advertising. “We don’t want to spend our time fighting legal battles. We want to inspire the next generation,” Sterling wrote. “And we want to be your friends.”

The Beastie Boys have now filed a counterclaim for copyright and trademark infringement, and violation of state right of publicity laws. “Unfortunately, rather than developing an original advertising campaign to inspire its customers to create and innovate, GoldieBlox has instead developed an advertising campaign that condones and encourages stealing from others,” the counterclaim said.

To read the complaint in GoldieBlox v. Island Def Jam, click here

To read GoldieBlox’s letter to the Beastie Boys, click here.

To read the counterclaim, click here

Why it matters: Since GoldieBlox removed the song and appeared ready to withdraw its complaint (the docket was still active at the time of this writing), the legal question of whether the song constituted copyright infringement or was a fair use had appeared likely to remain unresolved. However, the counterclaim has put that question before the court. The fair use test is a delicate balancing test, so it is hard to tell where a court will come out. Although GoldieBlox’s video was an advertisement for its products, the company was clearly engaging in commentary on the original version of the song, taking the “highly sexist” lyrics (as described by GoldieBlox in the complaint) and transforming them into a musical power anthem for girls.