Justin Martin will be doing his singing behind bars for a while.
The "High School Musical 3" star has been sentenced to 18 months in the house of correction after pleading guilty to multiple charges on Tuesday, the Suffolk County, Massachusetts district attorney's office told TheWrap on Tuesday.
Martin pleaded guilty to assault with a dangerous weapon, unlawful possession of a firearm, unlawful possession of ammunition, carrying a loaded firearm, and discharging a firearm within 500 feet of a building.
In addition to the 18-month sentence, Martin will be subjected to one year of probation, during which must remain drug- and alcohol-free and stay away from the location of his offense.
RELATED: See photos of Zac Efron through the years:
Zac Efron through the years
'High School Musical 3' star Justin Martin sentenced following police shootout
UNIVERSAL CITY , CA - JUNE 24: Actor Zac Efron arrives for 'The Revenge Of The Mummy - The Ride' Gala Benefit Opening At Universal Studios on June 24, 2004 in Los Angeles California. (Photo by Frazer Harrison/Getty Images)
Zac Efron and Shelley Buckner (Photo by Jeffrey Mayer/WireImage)
Corbin Bleu, Ashley Tisdale, Vanessa Hudgens and Zac Efron (Photo by Michael Bezjian/WireImage)
Zac Efron at the in Beverly Hills, California (Photo by Eric Neitzel/WireImage)
(EXCLUSIVE, Premium Rates Apply) Zac Efron **exclusive coverage** (Photo by Jeff Kravitz/FilmMagic)
Zac Efron (Photo by Albert L. Ortega/WireImage)
Zac Efron, winner Outstanding Children's Program for 'High School Musical' (Photo by Mathew Imaging/FilmMagic)
Brittany Snow and Zac Efron (Photo by John Shearer/WireImage)
LOS ANGELES, CA - JULY 14: Zac Efron arrives at the lunch of 'Hairspray Jewelry Collection' on July 14, 2007 in Los Angeles, California. (Photo by Jean Baptiste Lacroix/WireImage)
BEVERLY HILLS, CA - JULY 24: Zac Efron at the 'High School Musical 2' press conference at The Four Seasons Hotel in Beverly Hills, California on July 24, 2007. (Photo by Vera Anderson/WireImage)
Actors Zac Efron and Debra Messing on stage at the TNT/TBS broadcast of the 14th Annual Screen Actors Guild Awards at the Shrine Auditorium on January 27, 2008 in Los Angeles, California. 15311_js_0042.JPG
Actors Vanessa Hudgens and Zac Efron arrive at the 2008 Teen Choice Awards at Gibson Amphitheater on August 3, 2008 in Los Angeles, California. (Photo by Steve Granitz/WireImage)
LOS ANGELES, CA - SEPTEMBER 18: Actor Zac Efron arrives to the 6th Annual Teen Vogue Young Hollywood Party on September 18, 2008 in Los Angeles, California. (Photo by Jason Merritt/FilmMagic)
LOS ANGELES, CA - OCTOBER 16: Actress Vanessa Hudgens and Actor Zac Efron arrive at the Los Angeles Premiere of 'High School Musical 3' at the Galen Center at the University Of Southern California on October 16, 2008 in Los Angeles, California. (Photo by Gregg DeGuire/WireImage)
TOKYO - JANUARY 28: Actor Zac Efron (L) waves to the audience with actress Vanessa Hudgens during the 'High School Musical 3: Senior Year' Japan Premiere at Shinagawa Stellar Ball on January 28, 2009 in Tokyo, Japan. (Photo by Kiyoshi Ota/Getty Images)
PARIS - MARCH 24: Actor Zac Efron attends a photocall for the '17 Again' film on March 24, 2009 at Hotel Plaza Athenee in Paris, France. (Photo by Pascal Le Segretain/Getty Images)
SATURDAY NIGHT LIVE -- Episode 20 -- Pictured: (l-r) Andy Samberg as actor, Fred Armisen as Norada, Zac Efron as actor during the 'Gino's Pizza Rolls' skit on April 11, 2009 (Photo by Dana Edelson/NBC/NBCU Photo Bank via Getty Images)
Zac Efron at the Germany premiere of '17 Again' in Cinestar Sony Center in Berlin (Photo by Franziska Krug/Getty Images)
UNIVERSAL CITY, CA - AUGUST 09: Actor Zac Efron poses with Choice Movie Actor award for '17 Again' in press room during the 2009 Teen Choice Awards held at Gibson Amphitheatre on August 9, 2009 in Universal City, California. (Photo by Jason Merritt/Getty Images)
LONDON - NOVEMBER 18: Actor Zac Efron attends the 'Me & Orson Welles' UK Premiere at the Vue West End on November 18, 2009 in London, England. (Photo by Jon Furniss/WireImage)
AUSTIN, TX - NOVEMBER 30: Actor Zac Efron attends the Q&A portion of the premiere of Me And Orson Welles at The Paramount Theater on November 30, 2009 in Austin, Texas. (Photo by Jay West/WireImage)
SYDNEY, AUSTRALIA - FEBRUARY 16:(L-R) Actor Zac Efron and Australian Surf Legend Layne Beachley attend Oakley's 'Learn To Ride' charity learn-to-surf event in aid of the One Sight Foundation at Bondi Beach on February 16, 2010 in Sydney, Australia. (Photo by Mike Flokis/Getty Images)
BLOOMINGTON, MN - JULY 19: Actor Zac Efron promotes his new film 'Charlie St. Cloud' at the Best Buy Rotunda at Mall of America on July 19, 2010 in Bloomington, Minnesota. (Photo by Adam Bettcher/Getty Images)
Actors Vanessa Hudgens (L) and Zac Efron attends the 'Charlie St. Cloud' Premiere at Regency Village Theatre on July 20, 2010 in Westwood, California.
US actor Zac Efron poses on September 11, 2010 during the photocall of the movie 'Charlie St Cloud' presented off the competition at the 36th American Film Festival in Deauville, northwestern France. AFP PHOTO / FRANCOIS GUILLOT (Photo credit should read FRANCOIS GUILLOT/AFP/Getty Images)
LOS ANGELES, CA - JANUARY 05: Actor Zac Efron arrives at the 2011 People's Choice Awards at Nokia Theatre L.A. Live on January 5, 2011 in Los Angeles, California. (Photo by Steve Granitz/WireImage)
NEW YORK, NY - FEBRUARY 24: Zac Efron filming on location for 'New Year's Eve' on the streets of Manhattan on February 24, 2011 in New York City. (Photo by James Devaney/WireImage)
HOLLYWOOD, CA - DECEMBER 05: Actor Zac Efron arrives at the premiere of Warner Bros. Pictures' 'New Year's Eve' at Grauman's Chinese Theatre on December 5, 2011 in Hollywood, California. (Photo by Jason Merritt/Getty Images)
HOLLYWOOD, CA - APRIL 16: Actors Taylor Schilling and Zac Efron arrive at the Los Angeles premiere of 'The Lucky One' at Grauman's Chinese Theatre on April 16, 2012 in Hollywood, California. (Photo by Lester Cohen/WireImage)
CANNES, FRANCE - MAY 24: Actor Zac Efron speask at the 'The Paperboy' press conference during the 65th Annual Cannes Film Festival at Palais des Festivals on May 24, 2012 in Cannes, France. (Photo by Ian Gavan/Getty Images)
BLACK AND WHITE VERSION
US actor Zac Efron arrives for the screening of 'At any price' during the 69th Venice Film Festival on August 31, 2012 at Venice Lido. 'At any price' is competing for the golden Lion in the Venezia 69 section of the festival. AFP PHOTO / TIZIANA FABI (Photo credit should read TIZIANA FABI/AFP/GettyImages)
NEW YORK, NY - DECEMBER 20: Zac Efron is seen on the set of new film 'Are We Officially Dating?' on December 20, 2012 in New York City. (Photo by David Krieger/Bauer-Griffin/GC Images)
BEVERLY HILLS, CA - MARCH 26, 2013 - Actors Dennis Quaid and Zac Efron photographed at the Four Seasons hotel in Beverly Hills, California, on Tuesday, March 26, 2013. They are in the new father and son farm drama movie 'At Any Price.' (Photo by Ricardo DeAratanha/Los Angeles Times via Getty Images)
MIAMI, FL - JANUARY 24: Zac Efron on the set of 'Despierta America' at Univision Headquarters on January 24, 2014 in Miami, Florida. (Photo by Gustavo Caballero/WireImage)
LOS ANGELES, CA - JANUARY 27: Actors Zac Efron, Imogen Poots and Miles Teller arrive to the Los Angeles premiere of 'That Awkward Moment' at Regal Cinemas L.A. Live on January 27, 2014 in Los Angeles, California. (Photo by Gregg DeGuire/WireImage)
HOLLYWOOD, CA - MARCH 02: Actor Zac Efron attends the Oscars held at Hollywood & Highland Center on March 2, 2014 in Hollywood, California. (Photo by Steve Granitz/WireImage)
LOS ANGELES, CA - APRIL 13: Actor Zac Efron speaks onstage at the 2014 MTV Movie Awards at Nokia Theatre L.A. Live on April 13, 2014 in Los Angeles, California. (Photo by Lester Cohen/WireImage)
NEW YORK, NY - MAY 07: Zac Efron visits 'The Tonight Show Starring Jimmy Fallon' at Rockefeller Center on May 7, 2014 in New York City. (Photo by Theo Wargo/NBC/Getty Images for 'The Tonight Show Starring Jimmy Fallon')
LOS ANGELES, CA - APRIL 12: Actor Zac Efron poses backstage during The 2015 MTV Movie Awards at Nokia Theatre L.A. Live on April 12, 2015 in Los Angeles, California. (Photo by Kevin Mazur/MTV1415/WireImage)
LONDON, ENGLAND - AUGUST 11: (SUN NEWSPAPER OUT. MANDATORY CREDIT PHOTO BY DAVE J. HOGAN GETTY IMAGES REQUIRED) Zac Efron(L) and Emily Ratajkowski attend the European Premiere of 'We Are Your Friends' at Ritzy Brixton on August 11, 2015 in London, England. (Photo by Dave J Hogan/Getty Images)
THE TONIGHT SHOW STARRING JIMMY FALLON -- Episode 0314 -- Pictured: (l-r) Actor Zac Efron during an interview with host Jimmy Fallon on August 17, 2015 -- (Photo by: Douglas Gorenstein/NBC/NBCU Photo Bank via Getty Images)
NEW YORK, NY - AUGUST 18: Actor Zac Efron attends the 'We Are Your Friends' tour stop photo call and after party at the Marquee on August 18, 2015 in New York City. (Photo by Michael Loccisano/Getty Images)
The actor was arrested in July 2015 after an alleged shootout with police. Police said that officers were patrolling in the Dorchester neighborhood of Boston when they heard gunfire erupt and observed Martin running down the street with a gun in his hand.
Police pursued the actor after he pointed the gun at them. At the time a second suspect began to fire multiple shots at the officers.
Martin was fired upon but not struck, police said. After taking the actor to the ground, they recovered a loaded .22-caliber handgun.
A second suspect, described as a juvenile male, approached the police while carrying a loaded .25-caliber handgun, and was subdued and taken into custody.
The district attorney's office had recommended a sentence of three years in state prison followed by three years of probation.