The Sorcerer's Apprentice

In 740 AD, the mighty magician Merlin (James A. Stephens) has three apprentices. One, Maxim Horvath (Alfred Molina), betrays his master by joining forces with the evil sorceress Morgana le Fay (Alice Krige). Morgana mortally wounds Merlin before another apprentice, Veronica Gorloisen (Monica Bellucci), is able to rip Morgana's soul from her body and absorbs it into her own. As Morgana attempts to kill Veronica by possessing her from within, the third and final apprentice, Balthazar Blake (Nicolas Cage), stops her by imprisoning Morgana and Veronica in the "Grimhold", a magic prison in the shape of a nesting doll. Before dying, Merlin gives Balthazar a dragon ring that will identify the Prime Merlinian, Merlin's descendant and the only one able to defeat Morgana. While he searches for his descendant throughout history, Balthazar imprisons Morganians, sorcerers who try to release Morgana, including Horvath, into successive layers on the Grimhold.
In 2000, 10-year-old Dave Stutler (Jake Cherry), encounters Balthazar in a Manhattan antique store, after straying from his school field trip. When Balthazar gives Dave Merlin's dragon ring, the ring comes to life, and wraps itself around the boy's finger. When Balthazar goes to find the book of magic, Dave accidentally opens the Grimhold, releasing the imprisoned Horvath. While battling for possession of the Grimhold, Balthazar and Horvath are imprisoned in an ancient Chinese urn with a ten-year lock curse. Dave is then ridiculed by his classmates when he claims he saw magic, only to find the shop empty.
Ten years later in 2010, Dave (Jay Baruchel), now 20 years old, is a physics student at New York University, and meets his childhood crush Becky (Teresa Palmer). The ten-year imprisonment curse of the urn ends, releasing Horvath and Balthazar. Horvath pursues Dave and the Grimhold. Balthazar rescues Dave, riding an animated steel eagle adapted from a Chrysler Building gargoyle. Dave initially refuses to help Balthazar, having been under psychiatric care since their first meeting, until the elder agrees to leave after finding the Grimhold. They track the Grimhold to Chinatown, where Horvath has released the next Morganian, Sun Lok (Gregory Woo). Dave defeats Sun Lok, and Balthazar retrieves the Grimhold. Dave changes his mind, deciding that he likes magic after all, and agrees to become Balthazar's apprentice. He also becomes romantically involved with Becky against Balthazar's wishes and advice. Horvath enlists celebrity magician Drake Stone (Toby Kebbell) to get back the Grimhold. They attempt to kill Dave, but Balthazar saves him. Cued by Horvath, Dave demands to know the truth about Balthazar's quest. Balthazar reveals that Morgana is trapped in the Grimhold with Veronica. Morgana, if freed, would cast a spell called "The Rising", which would revive sorcerers from the dead and enslave mankind. Dave, the Prime Merlinian, a descendant of Merlin, will become powerful enough to cast spells without his ring, and is the only one who can stop her. Dave tries to use magic to clean his lab, but loses control of his animated cleaning mops, and, disillusioned, decides to give up on magic, until Becky changes his mind.
He returns to his underground subway lab, just as Drake and Horvath try to kill Balthazar and steal the Grimhold. Horvath, having no more use for Drake, casts a parasite spell and steals Drake's magic and his ring. Horvath releases the witch Abigail Williams, uses her to kidnap Becky, then steals her magic and pendant. He threatens to kill Becky, forcing Dave to surrender the Grimhold and his ring. Balthazar goes after Horvath in Battery Park, sure that Dave, without his ring, will be killed. Horvath releases Morgana, who begins the Rising Spell while Horvath animates the Charging Bull sculpture and commands it to attack Balthazar. Dave arrive and stuns Horvath while Balthazar's eagle flies away with the bull. Becky interrupts the Rising Spell, stunning Morgana. Balthazar takes Morgana, body and soul, from Veronica into himself, but Morgana escapes and tries to incinerate them. Dave stops her without his ring, proving that he is the Prime Merlinian. Morgana shoots energy bolts and kills Balthazar. Dave makes a Tesla coil out of the square's lamp posts and power lines and then destroys her. He revives Balthazar by restarting his heart. Balthazar and Veronica reunite. Dave and Becky kiss, and fly to France on Balthazar's eagle.
In a post-credits scene, Horvath takes his hat at Balthazar's shop.

Question: how was Horvath and Balthazar released?
Answer: the ten year curse of their imprisonment had ended