The commission of the peace was originally instituted in Scotland in the 16th century. Initially, justices were given the task of administering the county within which they resided until this work passed to the County Councils with their establishment in 1888. Justices of the peace were then left with jurisdiction in the licensing board and minor criminal cases. 
District courts were introduced in 1975 as a replacement for Burgh Police Courts and sat in each local authority area under summary procedure only.The Criminal Proceedings etc. (Reform) (Scotland) Act 2007 enabled the Scottish Ministers to replace District Courts by "Justice of the Peace Courts".
The new Justice of the Peace Courts are managed by the Scottish Court Service. Responsibility for the Courts was transferred from the local authorities in a rolling programme of court unification that concluded in February 2010. The District Courts were replaced by Justice of the Peace Courts as follows:
The individuals who sit in the Justice of the Peace Court are known as Justices of the Peace, Justices or JPs. Generally they are not legally qualified. A legally qualified person can become a Justice of the Peace, but cannot act in any proceedings in a Justice of the Peace court within their own Sheriffdom. Justices are appointed for a five-year renewable term by the Justices of the Peace Advisory Committees for each sheriffdom, acting on the basis of standards set by the Judicial Appointments Board for Scotland. 
There is no precedence between Justices; all are equal. However, a minority of JP courts operate with a bench of three justices, as opposed to a sole justice, in which circumstances a chair is appointed by those sitting on that day. They are collectively represented by the Scottish Justices Association 
JP courts have the power to sentence for imprisonment for any period not exceeding 60 days; a fine not exceeding level 4 on the standard scale; to find caution (in lieu of or in addition to such imprisonment or fine) for good behaviour for any period not exceeding six months and to an amount not exceeding level 4 on the standard scale; or failing payment of such fine or on failure to find such caution, to impose imprisonment in proportion to the amount of the fine, etc. They also have the power to make the same orders following conviction as the sheriff court, such as a disqualification order under section 40 of the Animal Health and Welfare (Scotland) Act 2006, and can disqualify a person from driving.  Since these powers were enlarged in 2007, JP courts have been involved in increasingly serious cases, where their powers are considered appropriate. Their judgments can be appealed to the High Court of Justiciary in the same way as any other criminal court.
Stipendary Magistrates in Glasgow
In Glasgow only, some JP courts are presided over by a legally qualified Stipendiary Magistrate, and these officeholders can be classed as having the same powers and responsibilities. However, the maximum sentence that a Stipendiary Magistrate may impose is 12 months imprisonment or a fine not exceeding £10,000, which is the same as that of a sheriff sitting alone.  The option of appointing a stipendiary to a busy lay court has reportedly existed since the end of the 19th century and their powers were extended soon after their introduction to match those exercised by a sheriff dealing with summary criminal business. The 2007 Act, and its predecessor legislation continues to make such arrangements available.