Get breaking news alerts and special reports. The news and stories that matter, delivered weekday mornings.

Three Southern California churches have sued the governor and local officials over orders that ban religious gatherings because of the coronavirus pandemic.

Gov. Gavin Newsom issued a stay-at-home order March 19 to help slow the spread of the coronavirus. The order says residents should stay home, except for essential needs or jobs. It requires indoor shopping malls and nonessential retail establishments to close.

But the pastors of three churches in Riverside and San Bernardino counties filed a federal lawsuit Monday in the Central District of California saying religious services should be deemed essential because they are important for the "spiritual health of the congregation."

Full coverage of the coronavirus outbreak

One pastor, Patrick Scales, said he believes he can have in-person services at his Shield of Faith Family Church in Fontana while also keeping congregants safe.

He said that worshippers can be seated with family units 6 feet apart and that everyone would wear masks when inside.

Let our news meet your inbox. The news and stories that matters, delivered weekday mornings. This site is protected by recaptcha

"Scales believes he can have in-person church services while making every effort to prevent contact between congregants by adhering to social distancing guidance, just as grocery stores, laundromats, and marijuana dispensaries are implementing to keep their customers safe," the lawsuit states.

Scales said that church service is especially important now during the pandemic and that he wants to open his doors "to help deal with the spiritual and physical needs of its congregants."

Wendy Gish, a member of Shield of Faith Family Church, said in the lawsuit that she would attend services if it were allowed.

Brenda Wood, senior pastor at Word of Life Ministries International in Riverside, held a drive-thru church service on Easter. Wood said worshippers followed social distancing guidelines by wearing masks and remaining in their cars, parked 6 feet apart.

She preached using a portable amplification system, according to the lawsuit. Wood said she would like to continue drive-up services every Sunday.

Another pastor, James Dean Moffatt of Church Unlimited in Indio, said that immediately after he learned about the virus he had his church cleaned and disinfected. He also provided sanitizing materials to everyone who entered the building and encouraged those who felt sick to stay home.

Moffatt held a service in his church on April 5 to mark Palm Sunday and was fined $1,000 for violating the state's order. The suit states that Moffatt "believes that scripture commands him as a pastor to lay hands on people and pray for them" but that he cannot do that if he is not allowed to hold in-person worship services.

Download the NBC News app for full coverage and alerts about the coronavirus outbreak

Harmeet K. Dhillon, chief executive of the Center for American Liberty, the California nonprofit organization filed the suit, told The Associated Press that the state should not be able to dictate how a person worships.

"If a Californian is able to go to Costco or the local marijuana shop or liquor store and buy goods in a responsible, socially distanced manner, then he or she must be allowed to practice their faith using the same precautions," she said.

The lawsuit accuses Newsom and other local officials of using the pandemic "to expand their authority by unprecedented lengths" by depriving residents of "fundamental rights protected by the U.S. and California Constitutions, including freedom of religion, speech, and assembly."

The governor's office was not immediately available for comment Tuesday.

The pastors are asking the court to declare that the orders violate residents' rights to freedom of religion and assembly.