Craving and attachment is what occurs to one caught in Mara's dominion, Mara's domain, Mara's lair and Mara's range. Mara is out there trying to entrap you.
“Mendicants, sensual pleasures are impermanent, hollow, false, and
deceptive. This is made by illusion, mendicants, lamented by fools.
Sensual pleasures in this life and in lives to come, sensual
perceptions in this life and in lives to come; both of these are
Māra’s dominion, Māra’s domain, Māra’s lair, and Māra’s range. They
conduce to bad, unskillful qualities such as desire, ill will, and
aggression.
MN 106
Mara the Wicked is the foremost of rulers, blazing with power and glory (AN 4.15). He is the one who tries to harm you, while the Buddha is the one who is trying to save you.
Suppose that in a forested wilderness there was an expanse of
low-lying marshes, and a large herd of deer lived nearby. Then along
comes a person who wants to harm, injure, and threaten them. They
close off the safe, secure path that leads to happiness, and open the
wrong path. There they plant domesticated male and female deer as
decoys so that, in due course, that herd of deer would fall to ruin
and disaster. Then along comes a person who wants to help keep the
herd of deer safe. They open up the safe, secure path that leads to
happiness, and close off the wrong path. They get rid of the decoys so
that, in due course, that herd of deer would grow, increase, and
mature.
I’ve made up this simile to make a point. And this is what it means.
‘An expanse of low-lying marshes’ is a term for sensual pleasures.‘A
large herd of deer’ is a term for sentient beings. ‘A person who wants
to harm, injure, and threaten them’ is a term for Māra the Wicked.
‘The wrong path’ is a term for the wrong eightfold path, that is,
wrong view, wrong thought, wrong speech, wrong action, wrong
livelihood, wrong effort, wrong mindfulness, and wrong immersion. ‘A
domesticated male deer’ is a term for greed and relishing. ‘A
domesticated female deer’ is a term for ignorance. ‘A person who wants
to help keep the herd of deer safe’ is a term for the Realized One,
the perfected one, the fully awakened Buddha. ‘The safe, secure path
that leads to happiness’ is a term for the noble eightfold path, that
is: right view, right thought, right speech, right action, right
livelihood, right effort, right mindfulness, and right immersion.
MN 19
Comments by Ven. Sujato in DN 16:
Māra is the Buddhist deity of death, sex, and delusion;
his aim is to trap beings in transmigration.
He appears in many guises, both real
and metaphorical, throughout the canon.
When one is in the state of the first jhana absorption, he would be out of the reach of Mara. From other suttas, we know that he would be temporarily free from the five hindrances in jhana absorption.
In the same way, there’s a time when a
mendicant, quite secluded from
sensual pleasures, secluded from unskillful qualities, enters and
remains in the first absorption, which has the rapture
and bliss born of seclusion, while placing
the mind and keeping it connected. At that
time the mendicant thinks, ‘Now I’m in a secure location and Māra
can’t do anything to me.’ And Māra the Wicked also thinks, ‘Now the
mendicant is in a secure location and we can’t do anything to them.
AN 9.39
To escape from Mara's dominion, one has to cut off all underlying tendencies (from DN 33 - sensual desire, repulsion, views, doubt, conceit, desire to be born, and ignorance).
Having cut off all underlying tendencies
that follow those drifting in Māra’s dominion,
they’re the ones in this world
who’ve truly crossed over,
having reached the ending of defilements.”
AN 8.29
We also hear of the "house builder". The traditional commentary says it is craving. I would have said it is ignorance.
Through many a birth in samsara have I wandered in vain, seeking the
builder of this house (of life). Repeated birth is indeed suffering!
O house-builder, you are seen! You will not build this house again.
For your rafters are broken and your ridgepole shattered. My mind has
reached the Unconditioned; I have attained the destruction of craving.
Dhp 153-154
Comments by Ven. Acharya Buddharakkhita:
According to the commentary, these verses are the Buddha's "Song of
Victory," his first utterance after his Enlightenment. The house is
individualized existence in samsara, the house-builder craving, the
rafters the passions and the ridge-pole ignorance.
Ignorance or avijja is the force of nature that gives rise to the mind-body phenomena, and also gives rise to the underlying tendencies that drive us towards craving. It's the natural or evolutionary instinct that drives us towards survival, sensual enjoyment and individual existence. And, according to the second noble truth, the cause of suffering is craving.
Mara is the personification of ignorance as a force of nature, a natural or evolutionary instinct, and not to be taken as a literal person.