I think it is possible. My idea (assuming that size of the network n
is known to all nodes):
Leader(i, n):
p := 1/n
id[i] := Random identifier of node i
p[i] := Choose 1 with probability p, 0 otherwise.
If p[i]==1, send message (id[i]) to the next node.
// p[i]==1 means i-th node pretends to be the leader
For next n rounds:
If received message (X), X!=id[i]:
p[i] := 0
Send message (X) to the next node.
// now after n rounds at most 1 node pretends to be the leader
// Chosen[i] will represent whether i-th node knows if there is a leader.
Chosen[i] := p[i];
If p[i]==1, send message (id[i]) to the next node.
For next n rounds:
If received message (X):
Chosen[i] := 1
Send message (X) to the next node.
// now every node knows whether the election went successfully
If Chosen[i]==0, then repeat from scratch.
And if you don't know the size of network:
Size(i):
Send message (id[i], 1) to the next node.
For each following round:
If received message (X, Y), X!=id[i]:
Send message (X, Y+1) to the next node.
If received message (X, Y), X==id[i]:
Size of the ring is Y.
Stop.
Size() takes n rounds and n² messages, Leader() takes 2n*e rounds on average for large n (if I recall this part of math correctly).