After being arrested almost four years ago, former Disney Channel actor Stoney Westmoreland was finally sentenced and headed to federal prison.

According to Utah district legal documents obtained by E! Online, the actor was sentenced to two years in prison. After serving time behind bars, he would be under supervised release as he was charged with trying to entice a minor into sex.

Westmoreland ultimately struck a deal with prosecutors as he pleaded guilty to a lesser charge.

Since he accepted the plea deal, his DNA will be collected, and he will register as a sex offender.

In addition, the 52-year-old actor should report all of the accounts he used for electronic communications and storage like social media accounts, e-mail, and more.

Authorities will also randomly inspect his computer device.

Since he's going to be registered as a sex offender, he's not allowed to have contact with individuals under 18 years old without the supervision of an adult.

The latest sentencing comes almost four years after being arrested on New Year's Eve 2018. Prosecutors in his home state of Utah charged him with six felony counts.

READ NOW: 'The Serpent' Star Tahar Rahim Joins Cast of Sony's 'Madame Web,' the Latest Iteration of Their Spider-Verse

Westmoreland allegedly tried having sex with a boy, which equals being charged with one second-degree felony count of "enticing a minor by internet of text" and four three-degree felony counts of "dealing in materials harmful to a minor."

Lastly, one third-degree felony count of "attempted sexual exploitation of a minor."

He was arrested after an entrapment operation organized by a Salt Lake County detective and the Organized Crime Unit.

They posed as a 13-year-old boy using the dating app Grindr.

Charging documents showed that the actor allegedly conversed with who he believed to be a kid and asked him if he would visit him in his hotel room to "engage in sexual activity."

Westmoreland also allegedly sent explicit photos.

The actor is popularly known for starring in the hit Disney Channel sitcom "Andi Mack." He played the character of grandfather Henry "Ham" Mack.

The media giant has issued a statement amid his arrest, saying he was ultimately dropped from the show and would not return on the show.

Aside from the series, he also starred in shows like "Better Call Saul," "Gilmore Girls," "Scandal," and "Agents of S.H.I.E.L.D."

READ ALSO: Dascha Polanco and Lil Rel Howery Cast Alongside Natasha Lyonne in Rian Johnson's 'Poker Face' Series