Generally, state and local governments in Maryland are protected from lawsuits through immunity. Similarly, employees of state and local governments are generally protected from lawsuits while they are acting within their official capacity. They are generally immune from lawsuits unless immunity is waived in some way. Immunity is specifically waived in some circumstances under the law. For example, a city government generally is not protected when carrying out proprietary functions—generally, propriety functions that are done for the benefit or profit of a corporation. In contrast, city governments are protected when carrying out government functions—generally, those that are sanctioned by the legislature, are only done for the benefit of the public and have no element of private interest. Employees also may lose the protection of immunity if they act with malice or gross negligence. Immunity for states such as the state of Maryland, as opposed to city and county government, is generally broader. But immunity may still be waived if, for example, the employee was not acting within the scope of their public duties or if the employee acted with malice or gross negligence.