America's Got Talent creator and judge Simon Cowell pulled an elaborate prank on fellow judge Sofia Vergara during the season 16 auditions. Cowell, who rose to fame in the United States from his nine-year stint as a judge on American Idol, launched the talent competition series in 2006 to great success. At the time, he was still on Idol. But after the American version of his singing reality show The X Factor ended after just three seasons, Cowell decided to become an AGT judge following Howard Stern's departure. He ended up missing half of season 15 last summer because of an electric motorcycle accident that resulted in him undergoing back surgery. The Voice coach Kelly Clarkson, Modern Family star Eric Stonestreet and Saturday Night Live cast member Kenan Thompson filled in for him.

Sitting alongside Cowell on the America's Got Talent judging panel are Vergara, Howie Mandel and Heidi Klum. Vergara is the newbie on the show, having only joined last year. She's best known for starring on Modern Family, which ran for 11 seasons. She was nominated for numerous awards for playing Gloria on the hit comedy series, and ended up winning a Screen Actors Guild Award in 2009, 2011, 2012 and 2013 with her fellow castmates.

Related: When America's Got Talent Is On & How To Watch The Show

Now that Cowell is back where he belongs on the America's Got Talent judging panel, he decided to have some fun at the expense of one of his fellow judges by pulling an elaborate prank on Vergara. At the end of the fourth audition episode of AGT, Cowell headed backstage to meet up with danger act and AGT alums Ryan Stock and AmberLynn, best known for a performance that went wrong in season 11 when a flaming arrow hit Stock's neck. After showing off their crossbow skills, they invited Cowell and Vergara to join them on the stage. Stock held a balloon over Cowell's head, and Vergara put on a blindfold. Once the actress could no longer see anything around her, the prank began. Crew members came out to attach a fake arrow to Cowell to make it look like he had been hit in the chest. He got down onto the floor in front of the target. Then Vergara was directed to fire the crossbow. The arrow was missing, of course, because the danger act didn't actually want her to shoot anything.

Afterwards, everyone gasped, leaving America's Got Talent judge Vergara unsure what to do. She finally took off her blindfold and looked on in horror as Cowell was seemingly injured. He brought her over and exclaimed, "I gotcha!" She stumbled backwards, trying to take in what just happened. When the judges got back to their seats, Vergara told Cowell, "You know I'm Colombian, and you know we take revenge."

The video package that played beforehand hinted that something mischievous was about to happen. Vergara mentioned that the danger acts could go horribly wrong at any moment, which prompted Cowell to smirk. But fans didn't know exactly what he had planned. It seemed like fellow AGT judges Mandel and Klum were left in the dark as well, but they enjoyed watching the prank as it unfolded. AGT should follow up on Vergara's comment about taking revenge. Maybe she can pull a prank on him later in the season, after some time has passed, when he's least expecting it.

America's Got Talent airs Tuesdays at 8pm on NBC.

Next: America's Got Talent: Why Nightbirde's Original 'It's Okay' Went Viral

Source: America's Got Talent/YouTube