In most common law jurisdictions, the attorney general or attorney-general is the main legal advisor to the government, and in some jurisdictions they may also have executive responsibility for law enforcement, prosecutions or even responsibility for legal affairs generally.
Law enforcement is any system by which some members of society act in an organized manner to enforce the law by discovering, deterring, rehabilitating, or punishing people who violate the rules and norms governing that society.
A common law legal system is characterized by case law developed by judges, courts, and similar tribunals, when giving decisions in individual cases that have precedential effect on future cases.
Law is a system of rules that are enforced through social institutions to govern behavior.
Did Donald Trump Bribe the Florida Attorney General? by The Late Show with Stephen Colbert
In practice, the extent to which the attorney-general personally provides legal advice to the government varies between jurisdictions, and even between individual office-holders within the same jurisdiction, often depending on the level and nature of the office-holder's prior legal experience.
Ohio Attorney General Backs Down To Planned Parenthood by The Young Turks
The term was originally used to refer to any person who holds a general power of attorney to represent a principal in all matters.
In the common law tradition, anyone who represents the state, especially in criminal prosecutions, is such an attorney.
Although a government may designate some official as the permanent attorney general, anyone who comes to represent the state in the same way may, in the past, be referred to as such, even if only for a particular case.
Today, however, in most jurisdictions the term is largely reserved as a title of the permanently appointed attorney general of the state, sovereign or other member of the royal family.
Civil law jurisdictions have similar offices, who may be variously called "procurators", "advocates general", "public attorneys", and other titles.
Many of these offices also use "attorney general" or "attorney-general" as the English translation of the title, although because of different historical provenance the nature of such offices is usually different from that of attorneys-general in common law jurisdictions.