DUBLIN — A Fremont priest accused of sexually assaulting a young teenager was sentenced to nearly five years in prison Friday.

Hector David Mendoza-Vela, also known as the Rev. David Mendoza-Vela, 42, was sentenced Friday at the East County Hall of Justice in Dublin to four years and eight months in prison after taking a plea deal in August.

He must also register as a sex offender for the rest of his life, and Judge Jon Rolefson ordered him to stay away from the victim, who was 14 years old at the time of the molestation, for 10 years, according to Alameda County Deputy District Attorney Colleen McMahon, who prosecuted his case.

Mendoza-Vela was originally charged with 30 criminal counts related to lewd acts with a child, but took the plea deal in August. He pleaded no contest to five counts of lewd or lascivious acts on a child age 14 or 15, on the condition that he would receive four years and eight months in prison. The rest of his 25 charges were dismissed as part of the negotiated agreement.

“His conduct is unacceptable for anyone, but especially for a man who is supposed to model virtue and grace, not sin and harm,” said Oakland Bishop Michael C. Barber in a statement Friday.

The lewd acts against the teen boy occurred during a span of 18 months, from June 2016 to December 2017. Mendoza-Vela was accused of inappropriately touching the boy 30 times, and confessed to investigators once he was arrested in March, court documents state.

In a recorded call with the boy and Mendoza-Vela, the man also admitted to the inappropriate touching of the boy’s genitals, and apologized. He told investigators once arrested that he believed he did it more than 25 times, and knew that “John Doe” was at least 14 years old when the molestation began.

At the conclusion of the interview with law enforcement, the priest even wrote a letter to the victim’s family, apologizing for the acts.

Mendoza-Vela had served as a priest in Alameda County since 2013, working at St. John’s Catholic Church in San Lorenzo and more recently at Corpus Christi Church in Fremont.

After his arrest, Bishop Barber announced in a letter to parishioners that Mendoza-Vela had been placed on administrative leave and not allowed to function as a priest. Since August, the church began a process (called the canonical process) regarding his status in the church. The Diocese said the canonical process can remove him from priesthood.

“Our prayers are with those who have suffered from his actions. I renew our offer of counseling, therapy, support and outreach to survivors of clergy sexual abuse,” Barber said his statement.

According to the Diocese, Mendoza-Vela came to the United States in 2008, is a legal resident and was ordained in May 2013.

In a 2008 article in The Catholic Voice, an online publication of the Oakland Diocese, it said that Mendoza-Vela considered “his vocation as ‘a call to serve the people of God, even in small things.’ ”

Staff writer Joseph Geha contributed to this story.