The Picts used matrilineal descent, with a maternal grandson a preferred heir to a Mormaordom. The Irish Gaels introduced patrilineal elective descent to the isles starting about 400AD. After the Pictish Kings, but before 1005, The Scots crown used the gaelic agnatic-elective system, then in 1005 Malcolm II made the monarchy hereditary, and inheritable by the female line in absence of a male line.
The Agnatic-elective system was the law of tanistry, also part of the traditional gaelic Brehon laws. It was formally abolished for the clans in in Scotland by King James VI, but had been on the decline for a while, absorbing more of the Anglo-Norman ideas about primogeniture for some time. Under Tanistry, the Clan’s second-in-command and heir as Chief was determined by an election, with the candidates being all males of a specific kin group. There was the thought that the chiefship should go to the eldest and most-worthy, but differences in opinion on how this should be applied led to a few massacres in MacLeod history, notably with the succession after William of Harris, John Mac Torquil of Lewis, and Roderick of Lewis. For MacLeods, Tanistry was also complicated by the fact the Norse Hebridean society had not used the system — they used Åsædesret, an eldest child priority male-preference Gavelkind inheritance similar to Orkney’s Udal property law — so it was diluted and not as clear cut as the Irish usage of it
Prior to 1000AD, this kin group was called the Indfine, and it was a 6-generation group of all living males descended in the male-line from a common 3rd Great-Grandfather, who was the chief of his day. This was necessary, since the levels of contemporary violence often attritted the body of eligible candidates, and they wanted to be sure to have some competent ones to choose from. If all the Indfine was wiped out, the property was evenly distributed among the surviving members of the sept (Irish Clan) by Gavelkind. After 1000AD, the group was the Derbfine, a 4-generation group of males descended in the male-line from a common great-grandfather. 16th century or so, the Irish went to a Gelfine, a 3-generation group with common grandfather, but the Scots use of the system had been in decline since the imposition of feudalism after the fall of the Lordship of the Isles, and largely abandoned it for feudal hereditary succession, but modified by brothers succeeding before children.
Early application of Åsædesret/gavelkind led to the creation of the two branches of MacLeods, and the cadet branches of each. The head of the senior cadet branch was called the Toiseach, and was considered the Captain of the Clan, the military leader. Under tanistry, a Toiseach may have become the elected Tanist, but under the influence of Feudalism, this became less common, the Chief’s succession normally going to his brothers, and then their sons, and later after the end of the clan system, the estate was entailed to pass to daughters if no sons – Which is how Dame Flora became a Chief in her own right. Feudalism in Scotland was ended by the Abolition of Feudal Tenure etc. (Scotland) Act 2000, with the last ‘Skat’ or Feudal taxes paid in 2004.