It took a few years to come to fruition, but on Monday, it became official: The Ultimate Fighting Championship will be coming to Boston next summer.

Governor Deval Patrick signed a bill into law making Massachusetts the 42d state to regulate mixed-martial arts, and that opens the door for the UFC to bring its events to TD Garden. According to Marc Ratner, the UFC’s vice president of regulatory affairs, the first card will be in either July or August.

“Boston has been on our wish list for a little bit more than three years,’’ said Ratner. “We actively started lobbying a little more than two years ago. Massachusetts is very special to [UFC president] Dana White because he was raised there in the first part of his life. The Boston Garden is where we want to bring a show.’’

Relatively speaking, the bill breezed through the legislative process. Ratner said the feedback was almost universally positive throughout; it was just a matter of being patient.

“My best analogy is that it was like a two-year pregnancy,’’ he said. “We weren’t sure when the baby was going to get born. Once we got it to the governor’s desk, we knew it was just a matter of time. It was very exciting and there were high fives and handshakes [in the UFC offices] because Massachusetts is very important to the sport of MMA and certainly to us at the UFC.’’

Dover’s Kenny Florian, who will fight Clay Guida in a lightweight bout Dec. 12 in Memphis, is one of the sport’s best local ambassadors. He addressed legislators at the State House last spring.

“Kenny Florian was tremendous,’’ said Ratner. “He is so articulate, he’s a great spokesman for the sport of mixed-martial arts. He’s what everyone should aspire to. He’s just fabulous for the sport.’’

The bill was sponsored by State Senator James Timilty, who is chairman of the Joint Committee on Public Safety and Homeland Security.

“Mixed-martial arts events are enormously popular in Massachusetts and held in venues across the state every day,’’ said Timilty in a statement. “That is why passing legislation to regulate the sport was so important. We want it to be safe for everyone.’’

Nancy Marrapese-Burrell can be reached at marrapese@globe.com.

© Copyright 2009 Globe Newspaper Company.